Logo Search packages:      
Sourcecode: launchtool version File versions  Download package

SystemException Class Reference

#include <Exception.h>

Inheritance diagram for SystemException:

ContextException Exception FileException

List of all members.


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

Definition at line 272 of file Exception.h.


Public Member Functions

virtual int code () const throw ()
 Get the system error code associated to the exception.
virtual std::string context () const throw ()
virtual std::string desc () const throw ()
 Get a string describing what happened that threw the exception.
virtual std::string system_desc () const throw ()
 Get the description of the error code.
 SystemException (int code, const std::string &context) throw ()
virtual const char * type () const throw ()
 Get a string tag identifying the exception type.

Protected Attributes

int _code
std::string _context

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

Generated by  Doxygen 1.6.0   Back to index