OpenWalnut  1.3.1
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | Friends | List of all members
WException Class Reference

Basic exception handler. More...

#include <WException.h>

+ Inheritance diagram for WException:

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

Detailed Description

Basic exception handler.

Definition at line 39 of file WException.h.

Constructor & Destructor Documentation

WException::WException ( const std::string &  msg = std::string())
explicit

Default constructor.

Parameters
msgException description.

Definition at line 50 of file WException.cpp.

References getBacktrace(), m_headlineColor, m_msg, and noBacktrace.

WException::WException ( const std::exception &  e)
explicit

Copy a std::exception and encapsulate it.

Parameters
ethe exception.

Definition at line 68 of file WException.cpp.

References getBacktrace(), m_headlineColor, m_msg, and noBacktrace.

WException::~WException ( )
throw (
)
virtual

Destructor.

Definition at line 85 of file WException.cpp.

Member Function Documentation

void WException::disableBacktrace ( )
static
std::string WException::getBacktrace ( ) const

Returns a call stacktrace.

Returns
The backtrace at the moment of "throw".

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.

Returns
Calltrace as string
Notes:
Isn't this useless? Should be removed.

Definition at line 96 of file WException.cpp.

References m_trace, and what().

Referenced by WExceptionTest::testGetMessage().

const char * WException::what ( ) const
throw (
)
virtual

Friends And Related Function Documentation

friend class WExceptionTest
friend

Only UnitTests are allowed to be a friend of this class.

Definition at line 44 of file WException.h.

Member Data Documentation

WTerminalColor WException::m_functionColor
private

Color used for function name.

Definition at line 115 of file WException.h.

Referenced by getBacktrace().

WTerminalColor WException::m_headlineColor
private

Color used for exception headline.

Definition at line 125 of file WException.h.

Referenced by WException().

WTerminalColor WException::m_labelColor
private

Color used for the "trace:" label.

Definition at line 110 of file WException.h.

Referenced by getBacktrace().

std::string WException::m_msg
protected

Message given during throw.

Definition at line 94 of file WException.h.

Referenced by WException(), what(), and WSegmentationFault::WSegmentationFault().

WTerminalColor WException::m_symbolColor
private

Color used for symbols.

Definition at line 120 of file WException.h.

Referenced by getBacktrace().

std::list< std::string > WException::m_trace
protected

Stack trace for identifying the source where this exception came from.

Notes:
Isn't this useless? Should be removed.

Definition at line 100 of file WException.h.

Referenced by getTrace(), and WExceptionTest::testGetMessage().

bool WException::noBacktrace = false
staticprotected

True if the backtrace should NOT be printed.

initialize static member.

Definition at line 105 of file WException.h.

Referenced by disableBacktrace(), and WException().


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