#include <exception.h>
This is the base class for exceptions that depend on system events, like exceptions on file or network I/O, on database access and so on. SystemExceptions introduces the keeping of an error code with an associated string description, and by defaults provides the textual description for Unix errno error codes. The exception context should be phrased like "doing X".
Example:
const char* fname = "foo.bar"; if ((fd = open(fname, O_RDONLY)) == -1) // Should not throw SystemException, but a more specialized derived // class like FileException throw SystemException(errno, stringf::fmt("opening %s read-only", fname));
Public Member Functions | |
System (const std::string &context) throw () | |
System (int code, const std::string &context) throw () | |
virtual const char * | type () const throw () |
Get a string tag identifying the exception type. | |
virtual int | code () const throw () |
Get the system error code associated to the exception. | |
virtual std::string | desc () const throw () |
Get the description of the error code. | |
Protected Attributes | |
int | m_errno |
wibble::exception::System::System | ( | const std::string & | context | ) | throw () |
wibble::exception::System::System | ( | int | code, | |
const std::string & | context | |||
) | throw () |
virtual const char* wibble::exception::System::type | ( | ) | const throw () [inline, virtual] |
Get a string tag identifying the exception type.
Reimplemented from wibble::exception::Generic.
Reimplemented in wibble::exception::File.
virtual int wibble::exception::System::code | ( | ) | const throw () [inline, virtual] |
string wibble::exception::System::desc | ( | ) | const throw () [virtual] |
Get the description of the error code.
Reimplemented from wibble::exception::Generic.
Reimplemented in wibble::exception::File.
References m_errno.
Referenced by wibble::exception::File::desc().
int wibble::exception::System::m_errno [protected] |
Referenced by desc().