Tagcoll::SystemException Class Reference

Base class for system exceptions. More...

#include <Exception.h>

Inheritance diagram for Tagcoll::SystemException:

Inheritance graph
[legend]
Collaboration diagram for Tagcoll::SystemException:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SystemException (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 system_desc () const throw ()
 Get the description of the error code.
virtual std::string desc () const throw ()
 Get a string describing what happened that threw the exception.

Protected Attributes

int _code

Detailed Description

Base class for system exceptions.

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


Constructor & Destructor Documentation

Tagcoll::SystemException::SystemException ( int  code,
const std::string &  context 
) throw () [inline]


Member Function Documentation

virtual const char* Tagcoll::SystemException::type (  )  const throw () [inline, virtual]

Get a string tag identifying the exception type.

Reimplemented from Tagcoll::ContextException.

Reimplemented in Tagcoll::FileException.

virtual int Tagcoll::SystemException::code (  )  const throw () [inline, virtual]

Get the system error code associated to the exception.

string Tagcoll::SystemException::system_desc (  )  const throw () [virtual]

Get the description of the error code.

virtual std::string Tagcoll::SystemException::desc (  )  const throw () [inline, virtual]

Get a string describing what happened that threw the exception.

Reimplemented from Tagcoll::ContextException.


Member Data Documentation

int Tagcoll::SystemException::_code [protected]


The documentation for this class was generated from the following files:
Generated on Sat Jan 17 03:38:16 2009 for libtagcoll by  doxygen 1.5.1