Loading...
Searching...
No Matches
BALL::Exception::GeneralException Class Reference
Foundation Classes » Common Definitions

`#include <BALL/COMMON/exception.h>`

Inheritance diagram for BALL::Exception::GeneralException:

## 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 * | file_
int | line_
std::string | name_
std::string | message_
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 occurred.
const char * | getFile () const
| Returns the file where it occurred.

## 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.

Definition at line 59 of file COMMON/exception.h.

## Constructor & Destructor Documentation

## GeneralException() [1/4]

BALL::Exception::GeneralException::GeneralException | ( |  | ) |

Default constructor.

## GeneralException() [2/4]

BALL::Exception::GeneralException::GeneralException | ( | const char * | file,
|  | int | line )

Constructor.

## GeneralException() [3/4]

BALL::Exception::GeneralException::GeneralException | ( | const char * | file,
|  | int | line,
|  | const String & | name,
|  | const String & | message )

Constructor.

## GeneralException() [4/4]

BALL::Exception::GeneralException::GeneralException | ( | const GeneralException & | exception | ) |

Copy constructor.

## ~GeneralException()

virtual BALL::Exception::GeneralException::~GeneralException | ( |  | ) |
throw | ( | ) |  |  |

virtual

Destructor.

## Member Function Documentation

## getFile()

const char * BALL::Exception::GeneralException::getFile | ( |  | ) | const

Returns the file where it occurred.

## getLine()

int BALL::Exception::GeneralException::getLine | ( |  | ) | const

Returns the line number where it occurred.

## getMessage()

const char * BALL::Exception::GeneralException::getMessage | ( |  | ) | const

Returns the error message of the exception.

## getName()

const char * BALL::Exception::GeneralException::getName | ( |  | ) | const

Returns the name of the exception.

## setMessage()

void BALL::Exception::GeneralException::setMessage | ( | const std::string & | message | ) |

Modify the exception's error message.

## Member Data Documentation

## file_

const char* BALL::Exception::GeneralException::file_

protected

Definition at line 107 of file COMMON/exception.h.

## line_

int BALL::Exception::GeneralException::line_

protected

Definition at line 108 of file COMMON/exception.h.

## message_

std::string BALL::Exception::GeneralException::message_

protected

Definition at line 111 of file COMMON/exception.h.

## name_

std::string BALL::Exception::GeneralException::name_

protected

Definition at line 110 of file COMMON/exception.h.