Orxonox: orxonox::Exception Class Reference

# orxonox::Exception Class Reference

Base class for all exceptions (derived from std::exception). More...

`#include <src/util/Exception.h>`

List of all members.

## Public Member Functions

| Exception (const std::string &description)
| Simplified constructor with just a description. If you need more, use the other one.
| Exception (const std::string &description, unsigned int lineNumber, const char *filename, const char *functionName)
| Creates the exception but doesn't yet compose the full descrption (because of the virtual functions).
virtual const std::string & | getDescription () const
| Returns the short developer written exception.
virtual const std::string & | getFilename () const
| Returns the filename in which the exception occurred.
virtual const std::string & | getFullDescription () const
| Returns a full description with type, line, file and function.
virtual const std::string & | getFunctionName () const
| Returns the function in which the exception occurred.
virtual const unsigned int | getLineNumber () const
| Returns the line number on which the exception occurred.
virtual std::string | getTypeName () const =0
| Returns the string name of the exception type.
const char * | what () const throw ()
| Returns the error description.
virtual | ~Exception () throw ()
| Needed for compatibility with std::exception.

## Protected Attributes

std::string | description_
| User typed text about why the exception occurred.
std::string | filename_
| File where the exception occurred.
std::string | fullDescription_
| Full description with line, file and function.
std::string | functionName_
| Function (including namespace and class) where the exception occurred.
unsigned int | lineNumber_
| Line on which the exception occurred.

## Detailed Description

Base class for all exceptions (derived from std::exception).

This class provides support for information about the file, the line and the function the error occured.

## Constructor & Destructor Documentation

orxonox::Exception::Exception | ( | const std::string & | description,
|  | unsigned int | lineNumber,
|  | const char * | filename,
|  | const char * | functionName |
| ) |  |  |

Creates the exception but doesn't yet compose the full descrption (because of the virtual functions).

Parameters:

  | description | Exception description as string. This message is supposed to help developers!

orxonox::Exception::Exception | ( | const std::string & | description | ) |

Simplified constructor with just a description. If you need more, use the other one.

virtual orxonox::Exception::~Exception | ( |  | ) | throw ()`[inline, virtual]`

Needed for compatibility with std::exception.

## Member Function Documentation

virtual const std::string& orxonox::Exception::getDescription | ( | void |  | ) | const`[inline, virtual]`

Returns the short developer written exception.

Referenced by what().

virtual const std::string& orxonox::Exception::getFilename | ( |  | ) | const`[inline, virtual]`

Returns the filename in which the exception occurred.

const std::string & orxonox::Exception::getFullDescription | ( |  | ) | const`[virtual]`

Returns a full description with type, line, file and function.

Remarks:
  The composed full description gets stored to fullDescription_. But for compliance with std::exception, this method has to be const. Hence fullDescription_ is declared as mutable.

References description_, filename_, fullDescription_, functionName_, getTypeName(), and lineNumber_.

Referenced by orxonox::FailQuest::invoke(), orxonox::CompleteQuest::invoke(), orxonox::AddQuestHint::invoke(), and orxonox::AddQuest::invoke().

virtual const std::string& orxonox::Exception::getFunctionName | ( |  | ) | const`[inline, virtual]`

Returns the function in which the exception occurred.

virtual const unsigned int orxonox::Exception::getLineNumber | ( |  | ) | const`[inline, virtual]`

Returns the line number on which the exception occurred.

virtual std::string orxonox::Exception::getTypeName | ( |  | ) | const`[pure virtual]`

Returns the string name of the exception type.

Referenced by getFullDescription().

const char * orxonox::Exception::what | ( |  | ) | const throw ()

Returns the error description.

References getDescription().

Referenced by orxonox::Loader::load().

## Member Data Documentation

std::string orxonox::Exception::description_`[protected]`

User typed text about why the exception occurred.

Referenced by getFullDescription().

std::string orxonox::Exception::filename_`[protected]`

File where the exception occurred.

Referenced by getFullDescription().

std::string orxonox::Exception::fullDescription_`[mutable, protected]`

Full description with line, file and function.

Referenced by getFullDescription().

std::string orxonox::Exception::functionName_`[protected]`

Function (including namespace and class) where the exception occurred.

Referenced by getFullDescription().

unsigned int orxonox::Exception::lineNumber_`[protected]`

Line on which the exception occurred.

Referenced by getFullDescription().

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

- src/util/Exception.h
- src/util/Exception.cc