torc-master
|
The Error object thrown by different methods of EdifOM. More...
#include <Error.hpp>
Data Structures | |
struct | StackFrameInfo |
Public Types | |
typedef std::map< std::string, boost::any > | Context |
Public Member Functions | |
Error (MessageId inId, const Context &inContext, const std::string &inFunction, const std::string &inFile, uint32_t inLine) | |
Error (MessageId inId, const std::string &inFunction, const std::string &inFile, uint32_t inLine) | |
~Error () throw () | |
Error (const Error &source) | |
Error & | operator= (const Error &source) |
const std::vector < StackFrameInfo > & | getStackTrace () const |
void | setCurrentLocation (const std::string &inFunction, const std::string &inFile, uint32_t inLine) |
const Context | getContextData () const |
void | saveContextData (const std::string &inName, const boost::any &inSource) |
const MessageId | getErrorMessageId () const |
Private Attributes | |
std::vector< StackFrameInfo > | mStackTrace |
Context | mContextData |
MessageId | mErrorMessageId |
The Error object thrown by different methods of EdifOM.
The Error class is used to convey exception information to the user. The error object is constructed by the throwing method and propagated upwards by the calling functions.
typedef std::map<std::string, boost::any> torc::generic::Error::Context |
torc::generic::Error::Error | ( | MessageId | inId, |
const Context & | inContext, | ||
const std::string & | inFunction, | ||
const std::string & | inFile, | ||
uint32_t | inLine | ||
) |
Constructor.
[in] | inId | Error message identifier that can be used to look up the message in MessageTable. |
[in] | inContext | Context data that will be saved inside this error object. |
[in] | inFunction | Function name from where this exception is being thrown. This will typically be set to FUNCTION. |
[in] | inFile | File name from where this exception is being thrown. This will typically be set to FILE. |
[in] | inLine | Line No. in the file from where this exception is being thrown. This will typically be set to LINE. |
Definition at line 42 of file Error.cpp.
torc::generic::Error::Error | ( | MessageId | inId, |
const std::string & | inFunction, | ||
const std::string & | inFile, | ||
uint32_t | inLine | ||
) |
|
inline |
Get the map of context data for this exception. This can be looked up by interested parties for context sensitive information. Note that the value_type for this map is boost::any and therefore an appropriate boost::any_cast is required to get the actual data.
Definition at line 186 of file Error.hpp.
|
inline |
|
inline |
Get the complete stack trace.
Definition at line 175 of file Error.hpp.
void torc::generic::Error::saveContextData | ( | const std::string & | inName, |
const boost::any & | inSource | ||
) |
Save a context sensitive data with a meaningful name, that can be retreived by interested catching contexts.
[in] | inName | Name of the data. |
[in] | inSource | Any type of data. The only restrictions are that the type of data should be copy constructible and assignable. |
Definition at line 79 of file Error.cpp.
void torc::generic::Error::setCurrentLocation | ( | const std::string & | inFunction, |
const std::string & | inFile, | ||
uint32_t | inLine | ||
) |
Set the current location. This method should be used by catching contexts to push location data into the error object.
[in] | inFunction | Function name from where this exception is being thrown. This will typically be set to FUNCTION. |
[in] | inFile | File name from where this exception is being thrown. This will typically be set to FILE. |
[in] | inLine | Line No. in the file from where this exception is being thrown. This will typically be set to LINE. |
Definition at line 73 of file Error.cpp.
|
private |