BALL::Exception::GeneralException Class Reference
[Common Definitions]

General exception class. More...

#include <exception.h>

Inheritance diagram for BALL::Exception::GeneralException:
Inheritance graph
[legend]

List of all members.


Public Member Functions

Constructors and Destructors
GeneralException ()
Default constructor.
GeneralException (const char *file, int line)
Constructor.
GeneralException (const char *file, int line, const String &name, const String &message)
Constructor.
GeneralException (const GeneralException &exception)
Copy constructor.
virtual ~GeneralException () throw ()
Destructor.
Accessors
const char * getName () const
Returns the name of the exception.
const char * getMessage () const
Returns the error message of the exception.
void setMessage (const std::string &message)
Modify the exception's error message.
int getLine () const
Returns the line number where it occured.
const char * getFile () const
Returns the file where it occured.

Protected Attributes

const char * file_
int line_
std::string name_
std::string message_

Detailed Description

General exception class.

This class is intended as a base class for all other exceptions. Each exception class should define a constructor taking a string and an int as parameters. These two values are interpreted as the current filename and line number and is usually printed in case of an uncaught exception. To support this feature, each throw directive should look as follows:

throw Exception::GeneralException(__FILE__, __LINE__);
__FILE__ and __LINE__ are built-in preprocessor macros that hold the desired information.
BALL provides its own terminate handler. This handler extracts as much information as possible from the exception, prints it to cerr and Log , and finally calls exits the program cleanly (with exit code 1). This can be rather inconvenient for debugging, since you are told where the exception was thrown, but in general you do not know anything about the context. Therefore terminate can also create a core dump. Using a debugger (e.g. dbx or gdb) you can then create a stack traceback. To create a core dump, you should set the environment variable BALL_DUMP_CORE to any (non empty) value.

Generated on Thu Aug 6 18:30:49 2009 for BALL by doxygen 1.5.8