#include <BasicException.h>

Public Member Functions | |
| BasicException () | |
| BasicException (const std::string message) | |
| BasicException (const std::string message, const BasicFileLocation &location) | |
| BasicException (const std::string message, BasicException &cause) | |
| BasicException (const std::string message, const BasicFileLocation &location, BasicException &cause) | |
| BasicException (const BasicException &e) | |
| Copy constructor. | |
| virtual | ~BasicException () |
| const std::string | getMessage () const |
| BasicFileLocation | getLocation () const |
| BasicSmartPointer< BasicException > | getCause () const |
| BasicSmartPointer< std::list < std::string > > | getTrace () const |
| std::ostream & | print (std::ostream &stream, bool printLocations=true, unsigned int printLevel=0) const |
Static Public Attributes | |
| static unsigned int | causePrintLevel = 10 |
| static bool | enableStackTraces = false |
Protected Member Functions | |
| void | init () |
Private Attributes | |
| std::string | message |
| BasicFileLocation | location |
| BasicSmartPointer< BasicException > | cause |
| BasicSmartPointer< std::list < std::string > > | trace |
Friends | |
| std::ostream & | operator<< (std::ostream &, const BasicException &) |
There are preprocessor macros that can be used to as a convient way to add the current file, line and column where the exception occured. These are:
and
ASSERT_OR_THROW(const string message, const bool condition)
The latter can be used to in place of assert(const bool condition). Throwing an exception instead of aborting overcomes some of the limitations of the standard assert.
Definition at line 61 of file BasicException.h.
| BasicException::BasicException | ( | ) | [inline] |
| BasicException::BasicException | ( | const std::string | message | ) | [inline] |
| BasicException::BasicException | ( | const std::string | message, | |
| const BasicFileLocation & | location | |||
| ) | [inline] |
| BasicException::BasicException | ( | const std::string | message, | |
| BasicException & | cause | |||
| ) | [inline] |
| BasicException::BasicException | ( | const std::string | message, | |
| const BasicFileLocation & | location, | |||
| BasicException & | cause | |||
| ) | [inline] |
| BasicException::BasicException | ( | const BasicException & | e | ) | [inline] |
| virtual BasicException::~BasicException | ( | ) | [inline, virtual] |
Definition at line 99 of file BasicException.h.
| const std::string BasicException::getMessage | ( | ) | const [inline] |
Definition at line 101 of file BasicException.h.
References message.
Referenced by CC3DTransaction::simulationThreadPython().
| BasicFileLocation BasicException::getLocation | ( | ) | const [inline] |
Definition at line 102 of file BasicException.h.
References location.
Referenced by CC3DTransaction::simulationThreadPython().
| BasicSmartPointer<BasicException> BasicException::getCause | ( | ) | const [inline] |
Definition at line 108 of file BasicException.h.
References cause.
| BasicSmartPointer<std::list<std::string> > BasicException::getTrace | ( | ) | const [inline] |
| std::ostream& BasicException::print | ( | std::ostream & | stream, | |
| bool | printLocations = true, |
|||
| unsigned int | printLevel = 0 | |||
| ) | const [inline] |
Prints the complete exception recuring down to the cause exception if not null. WARNING: If there are many layers of causes this function could print a very large amount of data. This can be limited by setting the causePrintLevel variable.
| stream | The output stream. | |
| printLocations | Print file locations. | |
| printLevel | The current cause print level. |
Definition at line 124 of file BasicException.h.
References cause, causePrintLevel, enableStackTraces, BasicFileLocation::isEmpty(), BasicSmartPointer< T, alloc_t >::isNull(), location, message, and trace.
Referenced by operator<<().
| void BasicException::init | ( | ) | [inline, protected] |
Definition at line 156 of file BasicException.h.
References enableStackTraces, and trace.
Referenced by BasicException().
| std::ostream& operator<< | ( | std::ostream & | stream, | |
| const BasicException & | e | |||
| ) | [friend] |
An stream output operator for BasicException. This allows you to print the text of an exception to a stream like so:
. . . } catch (BasicException &e) { cout << e << endl; return 0; }
Definition at line 181 of file BasicException.h.
std::string BasicException::message [private] |
BasicFileLocation BasicException::location [private] |
BasicSmartPointer<BasicException> BasicException::cause [private] |
BasicSmartPointer<std::list<std::string> > BasicException::trace [private] |
unsigned int BasicException::causePrintLevel = 10 [static] |
bool BasicException::enableStackTraces = false [static] |
1.5.6