Base exception class for all operating system errors. More...
Inherits std::runtime_error.
Public Member Functions | |
system_error (int ec, std::string const &context) | |
Construct a system_error using an errno and a textual context description. | |
Public Attributes | |
int | error_code |
The errno value returned by operating system. |
Base exception class for all operating system errors.
System errors are are caused by external conditions such as a network connection timing out, lack of resources, or some other OS-specific problem. The exact nature of the error is described by the standard errno
code, respectively a human-readable string that can be obtained through the inherited method std::exception::what(). For example, the expression
system_error(ENOSPC, "writing to /tmp/test.data").what()
would return:
writing to /tmp/test.data: No space left on device
The textual descriptions are obtained from std::strerror().
ioxx::system_error::system_error | ( | int | ec, | |
std::string const & | context | |||
) |
Construct a system_error using an errno
and a textual context description.
The string used to describe the context will be prepended to the actual error message that can be retrieved with std::exception::what().
ec | Native errno code that describes the error. | |
context | Description of the system call context that failed. |