the type of the exception thrown by various library functions (typically the functions that interface with the OS facilities...) when the exception has an associated
std::error_code
, which may be reported.
Now, I'm writing some code (a library, in fact) which interacts with a driver, and that driver returns its own error codes (not the same as the C library errno
).
I could, theoretically, write an std::error_category
for these, and return std::system_error
's with no error number and the appropriate category.
My question: Should I do this, or will this be trespassing into something I should keep out of? (In the latter case, I'm just rolling my own exception class carrying an error code)
Note: Somewhat related to: C++11 (or Boost) system_error strategy
Aucun commentaire:
Enregistrer un commentaire