Exception class associated with a system error. More...
#include <systemerror.h>
Public Member Functions | |
SystemError (int error_code=0) | |
Construct new runtime_error exception. | |
SystemError (const std::string &message, int error_code=0) | |
Construct new runtime_error exception. | |
int | err_no () const |
Static Public Member Functions | |
static std::string | strerror (int err=0) |
Private Attributes | |
int | errno_ |
Exception class associated with a system error.
Derived from runtime_error.
Example:
if (fork() == -1) throw SystemError(); if (execl(..) == -1) throw SystemError("execl failed"); if (kill(..,..) == -1) { int e = errno; throw SystemError(e); }
Definition at line 27 of file systemerror.h.
Dv::Util::SystemError::SystemError | ( | int | error_code = 0 |
) |
Construct new runtime_error exception.
this->what()
will contain NAME + error_code + system error message obtained using strerror(error_code)
error_code | system error code, should be valid input for strerror. If 0, the global :errno will be used instead. |
Dv::Util::SystemError::SystemError | ( | const std::string & | message, | |
int | error_code = 0 | |||
) |
Construct new runtime_error exception.
this->what()
will contain message + error_code + system error message obtained using strerror(error_code)
message | will be used instead of NAME (see above) | |
error_code | system error code, should be valid input for strerror. If 0, the global :errno will be used instead. |
int Dv::Util::SystemError::err_no | ( | ) | const [inline] |
Definition at line 56 of file systemerror.h.
References errno_.
static std::string Dv::Util::SystemError::strerror | ( | int | err = 0 |
) | [static] |
int Dv::Util::SystemError::errno_ [private] |
Definition at line 59 of file systemerror.h.
Referenced by err_no().
dvutil-1.0.10 | [ 5 December, 2009] |