senf::SystemException Class Reference
[Exception classes]

Exception handling standard UNIX errors (errno). More...

#include <senf/Utils/Exception.hh>

Inheritance diagram for senf::SystemException:
Inheritance graph
[legend]

List of all members.


Detailed Description

Exception handling standard UNIX errors (errno).

This exception is thrown to signal generic errno failures. Normally the errno value is automatically taken from the errno variable but it may also be specified explicitly:

// Standard usage: Take \c errno from environment
throw senf::SystemException("::open()")
    << " while opening configuration file: " << filename;

// You may however explicitly specify the errno value
throw senf::SystemException("::open()", ENOFILE)

// Or leave the location information empty
throw senf::SystemException(ENOFILE);
throw senf::SystemException();

From within SENF (and only there because it depends on the SENF_DEBUG symbol), SystemException should be thrown using wrapper macros which add additional information to the exception description:

// Standard usage: Take \c errno from environment
SENF_THROW_SYSTEM_EXCEPTION("::open()")
    << " while opening configuration file: " << filename;

// You may however explicitly specify the errno value
throw senf::SystemException("::open()", ENOFILE SENF_EXC_DEBUGINFO)

Definition at line 281 of file Exception.hh.


Public Member Functions

int  errorNumber () const
  Error code (errno number).
char const *  errorString () const
  Error string (strerror() value).
bool  anyOf (int c0, int c1=0, int c2=0, int c3=0, int c4=0, int c5=0, int c6=0, int c7=0, int c8=0, int c9=0) const
  true, if errorNumber() is one of c0 ... c9

Structors and default members

  SystemException (std::string const &descr=""_SENF_EXC_DEBUG_ARGS)
  SystemException (int code _SENF_EXC_DEBUG_ARGS)
  SystemException (std::string const &descr, int code _SENF_EXC_DEBUG_ARGS)
virtual  ~SystemException () throw ()

Constructor & Destructor Documentation

senf::SystemException::
SystemException ( std::string const &  descr = ""_SENF_EXC_DEBUG_ARGS )

senf::SystemException::
SystemException ( int code  _SENF_EXC_DEBUG_ARGS )

Definition at line 81 of file Exception.cci.

senf::SystemException::
SystemException ( std::string const &  descr,
int code  _SENF_EXC_DEBUG_ARGS )

Definition at line 86 of file Exception.cci.

senf::SystemException::
~SystemException ()

Definition at line 121 of file Exception.cci.


Member Function Documentation

bool senf::SystemException::
anyOf ( int  c0,
int  c1 = 0,
int  c2 = 0,
int  c3 = 0,
int  c4 = 0,
int  c5 = 0,
int  c6 = 0,
int  c7 = 0,
int  c8 = 0,
int  c9 = 0 )

true, if errorNumber() is one of c0 ... c9

Definition at line 104 of file Exception.cci.

int senf::SystemException::
errorNumber ()

Error code (errno number).

Definition at line 92 of file Exception.cci.

char const * senf::SystemException::
errorString ()

Error string (strerror() value).

Definition at line 98 of file Exception.cci.


The documentation for this class was generated from the following files: