senf::SystemException Class Reference

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

#include <senf/Utils/Exception.hh>

Inheritance diagram for senf::SystemException:

Public Member Functions

int errorNumber () const
 Error code (errno number) More...
 
char const * errorString () const
 Error string (strerror() value) More...
 
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 More...
 
- Public Member Functions inherited from senf::Exception
virtual ~Exception () throw ()
 
virtual char const * what () const throw ()
 get exception description and backtrace if available More...
 
- Public Member Functions inherited from senf::ExceptionMixin
std::string message () const
 get exception description More...
 
std::string backtrace () const
 Return backtrace (if available) More...
 
void append (std::string text)
 Extend exception description. More...
 

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 ()
 

Additional Inherited Members

- Protected Member Functions inherited from senf::Exception
 Exception (std::string const &description="")
 
- Protected Member Functions inherited from senf::ExceptionMixin
 ExceptionMixin (std::string const &description="")
 Initialize exception with string. More...
 
- Protected Attributes inherited from senf::ExceptionMixin
std::string what_
 

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);
    From within SENF (<em>and only there because it depends on the \c SENF_DEBUG symbol</em>),
    SystemException should be thrown using wrapper macros which add additional information to
    the exception description:
// Standard usage: Take \c errno from environment
<< " while opening configuration file: " << filename;
// You may however explicitly specify the errno value
throw senf::SystemException("::open()", ENOFILE SENF_EXC_DEBUGINFO)

Definition at line 286 of file Exception.hh.

Constructor & Destructor Documentation

◆ SystemException() [1/3]

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

◆ SystemException() [2/3]

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

◆ SystemException() [3/3]

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

◆ ~SystemException()

virtual senf::SystemException::~SystemException ( )
throw (
)
virtual

Member Function Documentation

◆ anyOf()

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 
) const

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

◆ errorNumber()

int senf::SystemException::errorNumber ( ) const

Error code (errno number)

◆ errorString()

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

Error string (strerror() value)


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