OpenWalnut
1.5.0dev
|
Basic exception handler. More...
#include <WException.h>
Public Member Functions | |
WException (const std::string &msg=std::string()) | |
Default constructor. More... | |
WException (const std::exception &e) | |
Copy a std::exception and encapsulate it. More... | |
virtual | ~WException () throw () |
Destructor. More... | |
virtual const char * | what () const throw () |
Returns the message string set on throw. More... | |
std::string | getTrace () const |
Prints the trace of the call chain which caused this exception. More... | |
std::string | getBacktrace () const |
Returns a call stacktrace. More... | |
Static Public Member Functions | |
static void | disableBacktrace () |
Function disables backtraces. More... | |
Protected Attributes | |
std::string | m_msg |
Message given during throw. More... | |
std::list< std::string > | m_trace |
Stack trace for identifying the source where this exception came from. More... | |
Static Protected Attributes | |
static bool | noBacktrace = false |
True if the backtrace should NOT be printed. More... | |
Private Attributes | |
WTerminalColor | m_labelColor |
Color used for the "trace:" label. More... | |
WTerminalColor | m_functionColor |
Color used for function name. More... | |
WTerminalColor | m_symbolColor |
Color used for symbols. More... | |
WTerminalColor | m_headlineColor |
Color used for exception headline. More... | |
Friends | |
class | WExceptionTest |
Only UnitTests are allowed to be a friend of this class. More... | |
Basic exception handler.
Definition at line 38 of file WException.h.
|
explicit |
Default constructor.
msg | Exception description. |
Definition at line 50 of file WException.cpp.
References getBacktrace(), m_headlineColor, m_msg, and noBacktrace.
|
explicit |
Copy a std::exception and encapsulate it.
e | the exception. |
Definition at line 68 of file WException.cpp.
References getBacktrace(), m_headlineColor, m_msg, and noBacktrace.
|
virtual |
Destructor.
Definition at line 85 of file WException.cpp.
|
static |
Function disables backtraces.
Please note that the backtrace can not be reactivated to avoid people from dis/enabling them at will.
Definition at line 200 of file WException.cpp.
References noBacktrace.
Referenced by WPropertiesTest::testAdd(), WPropertiesTest::testClear(), WPropertyVariableTest::testClone(), WPropertyVariableTest::testConstraintManagement(), WPropertiesTest::testGetAndExistsAndFind(), WPropertyVariableTest::testMinMaxWithSetAndAccept(), WModuleConnectorTest::testModuleConnectorCompatibility(), WModuleConnectorTest::testModuleConnectorTypeCompatibility(), WModuleConnectorTest::testModuleInvalidData(), WModuleConnectorTest::testModuleTwiceInitialization(), WPropertyVariableTest::testNameConvention(), WPropertiesTest::testRecursiveSetByProperty(), and WPropertiesTest::testRemove().
std::string WException::getBacktrace | ( | ) | const |
Returns a call stacktrace.
Definition at line 107 of file WException.cpp.
References m_functionColor, m_labelColor, m_symbolColor, and what().
Referenced by WExceptionTest::testBacktrace(), and WException().
std::string WException::getTrace | ( | ) | const |
Prints the trace of the call chain which caused this exception.
Definition at line 96 of file WException.cpp.
References m_trace, and what().
Referenced by WExceptionTest::testGetMessage().
|
virtual |
Returns the message string set on throw.
Definition at line 90 of file WException.cpp.
References m_msg.
Referenced by WQtGui::deferredLoad(), getBacktrace(), getTrace(), WThreadedRunner::handleDeadlyException(), WWorkerThreadTest::handleException(), WModuleLoader::load(), WQtGui::moduleError(), WApplication::notify(), WScriptUI::run(), WReaderCSVTest::testEmptyCSV(), WMatrixSymTest::testInvalidAccessOnMainDiagonal(), WReaderCSVTest::testInvalidColumnNumber(), WLineTest::testMidPointOnEmptyLine(), WGridRegular3DTest::testNeighbourOfVoxelNotInsideThisGrid(), WReaderCSVTest::testOnlyHeaderCSV(), WPolynomialEquationSolversTest::testRealQuadraticEquationWithNoSolution(), WProtonDataTest::testSetCSVDataNull(), WProtonDataTest::testSetCSVHeaderEmpty(), WProtonDataTest::testSetCSVHeaderNull(), WMatrixSymTest::testSetDataWithInvalidLengthForDimension(), WWorkerThread< Function_T >::threadMain(), and WModuleMetaInformation::WModuleMetaInformation().
|
friend |
Only UnitTests are allowed to be a friend of this class.
Definition at line 43 of file WException.h.
|
private |
Color used for function name.
Definition at line 114 of file WException.h.
Referenced by getBacktrace().
|
private |
Color used for exception headline.
Definition at line 124 of file WException.h.
Referenced by WException().
|
private |
Color used for the "trace:" label.
Definition at line 109 of file WException.h.
Referenced by getBacktrace().
|
protected |
Message given during throw.
Definition at line 93 of file WException.h.
Referenced by WException(), what(), and WSegmentationFault::WSegmentationFault().
|
private |
|
protected |
Stack trace for identifying the source where this exception came from.
Definition at line 99 of file WException.h.
Referenced by getTrace(), and WExceptionTest::testGetMessage().
|
staticprotected |
True if the backtrace should NOT be printed.
initialize static member.
Definition at line 104 of file WException.h.
Referenced by disableBacktrace(), and WException().