MIRA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Exception Class Reference

Base class for exceptions. More...

#include <error/Exception.h>

Inheritance diagram for Exception:
Inheritance graph
[legend]

Classes

struct  Info
 The info packet that is added in MIRA_THROW and MIRA_RETHROW. More...
 

Public Member Functions

 Exception (const std::string &message, const char *file=NULL, int line=0) MIRA_NOEXCEPT_OR_NOTHROW
 The constructor. More...
 
virtual ~Exception () MIRA_NOEXCEPT_OR_NOTHROW
 Destructor. More...
 
void addInfo (const std::string &message, const char *file=NULL, int line=0)
 Adds additional information to the exception. More...
 
virtual const char * what () const MIRA_NOEXCEPT_OR_NOTHROW
 Returns the text of exception containing the information given in MIRA_THROW and MIRA_RETHROW as well as the file name and line number where it was thrown. More...
 
std::string message () const MIRA_NOEXCEPT_OR_NOTHROW
 Similar to what(). More...
 
const CallStackcallStack () const
 Returns the state of the callstack at the moment when the exception was thrown. More...
 
ThreadID getThreadID () const
 Returns the id of the thread where the exception was thrown. More...
 
template<typename DerivedException >
DerivedException & addStackInfo ()
 FOR INTERNAL USE ONLY. More...
 
template<typename DerivedException >
DerivedException & addExternalStackInfo (const CallStack &stack, ThreadID thread)
 Stores the provided callstack and thread id within the exception. More...
 
const InfogetInfo () const
 Returns the first info packet that describes the location where the exception has occured. More...
 

Protected Member Functions

 Exception () MIRA_NOEXCEPT_OR_NOTHROW
 

Protected Attributes

std::list< InfomInfos
 
CallStack mStack
 
ThreadID mThreadID
 
std::string mMessage
 as cache for what() More...
 

Detailed Description

Base class for exceptions.

The what()-text contains file name and line number where the exception was thrown as well as additional information that was specified in MIRA_THROW and MIRA_RETHROW.

This exception class also keeps track of the call stack, which can be used to improve tracing of errors and exceptions.

For detailed information see Error and Exception Handling.

See Also
MIRA_THROW, MIRA_RETHROW

Constructor & Destructor Documentation

Exception ( )
inlineprotected
Exception ( const std::string &  message,
const char *  file = NULL,
int  line = 0 
)
inline

The constructor.

Note
Ususally this constructor is not called directly, instead MIRA_THROW should be used to create and throw an exception.
See Also
MIRA_THROW
virtual ~Exception ( )
inlinevirtual

Destructor.

Member Function Documentation

void addInfo ( const std::string &  message,
const char *  file = NULL,
int  line = 0 
)
inline

Adds additional information to the exception.

Note
Ususally this method is not called directly, instead MIRA_RETHROW should be used to add additional information and to rethrow the exception.
See Also
MIRA_THROW, MIRA_RETHROW
virtual const char* what ( ) const
virtual

Returns the text of exception containing the information given in MIRA_THROW and MIRA_RETHROW as well as the file name and line number where it was thrown.

See Also
MIRA_THROW, MIRA_RETHROW
std::string message ( ) const

Similar to what().

Returns the text of exception containing the information given in MIRA_THROW and MIRA_RETHROW without the file name and line number in a single line string.

See Also
MIRA_THROW, MIRA_RETHROW
const CallStack& callStack ( ) const
inline

Returns the state of the callstack at the moment when the exception was thrown.

ThreadID getThreadID ( ) const
inline

Returns the id of the thread where the exception was thrown.

DerivedException& addStackInfo ( )
inline

FOR INTERNAL USE ONLY.

Stores the current callstack and thread id within the exception. This method is called by the MIRA_THROW macro and is for internal use. You never need to call this method manually.

DerivedException& addExternalStackInfo ( const CallStack stack,
ThreadID  thread 
)
inline

Stores the provided callstack and thread id within the exception.

This can be used to create an exception with a callstack from an external source (e.g. for an exception originally thrown in an RPC).

const Info& getInfo ( ) const
inline

Returns the first info packet that describes the location where the exception has occured.

Member Data Documentation

std::list<Info> mInfos
protected
CallStack mStack
protected
ThreadID mThreadID
protected
std::string mMessage
mutableprotected

as cache for what()


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