Exception class for managing system errors.
More...
#include "carma/util/BaseException.h"
|
virtual ::std::string | getLogString () const |
|
virtual const char * | getSysMessage () const |
| gets error message set within this instance. More...
|
|
SystemException & | operator= (const SystemException &rhs) |
|
| SystemException (const SystemException &rhs) |
|
| SystemException (const char *mesg, const char *sysMesg=strerror(errno), const char *fileName=__FILE__, const int lineNum=__LINE__) |
| Constructor - creates an instance of class SystemException. More...
|
|
| SystemException (std::ostringstream &message, const char *sysMessage=strerror(errno), const char *fileName=__FILE__, const int lineNum=__LINE__) |
| Constructor - creates an instance of class SystemException. More...
|
|
| SystemException (std::ostringstream &message, const std::ostringstream sysMessage=std::ostringstream(strerror(errno)), const char *fileName=__FILE__, const int lineNum=__LINE__) |
| Constructor - creates an instance of class SystemException. More...
|
|
| SystemException (std::string &istring, const std::string sysMessage=strerror(errno), const char *fileName=__FILE__, const int lineNum=__LINE__) |
| Constructor - creates an instance of class SystemException. More...
|
|
virtual | ~SystemException () throw ( ) |
| Destructor for SystemException. More...
|
|
Backtrace | getBacktrace () const |
|
virtual int | getLineNumber () const |
|
virtual ::std::string | getLogString () const |
|
virtual const char * | getMessage () const |
|
virtual const char * | getSourceFile () const |
|
void | logException (log4cpp::Priority::PriorityLevel priority) const |
|
virtual void | setMessageDirectly (const char *mesg) |
|
virtual void | setMessageToCopy (const char *mesg) |
|
virtual void | setMessageToCopy (const ::std::string &mesg) |
|
virtual void | setMessageToCopy (const ::std::ostringstream &oss) |
|
virtual const char * | what () const throw ( ) |
|
virtual | ~BaseException () throw ( ) |
|
|
| BaseException (const BaseException &rhs) |
|
| BaseException (const char *mesg, const char *fileName, const int lineNo) |
| Constructor - creates an instance of class BaseException. More...
|
|
| BaseException (const char *mesg, const ::std::string &fileName, const int lineNo) |
|
| BaseException (const ::std::string &mesg, const char *fileName, const int lineNo) |
|
| BaseException (const ::std::string &mesg, const ::std::string &fileName, const int lineNo) |
|
| BaseException (const ::std::ostringstream &oss, const char *fileName, const int lineNo) |
|
| BaseException (const ::std::ostringstream &oss, const ::std::string &fileName, const int lineNo) |
|
BaseException & | operator= (const BaseException &rhs) |
|
virtual void | setLineNumber (int num) |
|
void | setSourceFileDirectly (const char *file) |
|
void | setSourceFileToCopy (const char *file) |
|
void | setSourceFileToCopy (const ::std::string &file) |
|
std::ostream & | operator<< (::std::ostream &os, const ::std::exception &error) |
| Insert (i.e. output) the error message from any ::std::exception into an output stream. More...
|
|
Exception class for managing system errors.
Class that automatically system error messages and provides facilities for logging error messages to a log4cpp logger.
Definition at line 46 of file SystemException.h.
carma::util::SystemException::SystemException |
( |
const char * |
mesg, |
|
|
const char * |
sysMesg = strerror(errno) , |
|
|
const char * |
fileName = __FILE__ , |
|
|
const int |
lineNum = __LINE__ |
|
) |
| |
Constructor - creates an instance of class SystemException.
Users should use the macro definition (see the #define towards the end of this file).
- Parameters
-
mesg | The message to be logged for this exception. If the exception is to be caught outside the scope of the function where the exception was constructed, then 'mesg' should not be a stack variable. Stack variables are lost as the exception unwinds stacks on its way to the catcher. |
sysMesg | The system error message to be logged for this exception. If the exception is to be caught outside the scope of the function where the exception was constructed, then 'sysMesg' should not be a stack variable. Stack variables are lost as the exception unwinds stacks on its way to the catcher. |
fileName | The source file containing the code throwing the exception - can be set using the cpp macro 'FILE'. |
lineNum | The line number in the source file where the exception is created - should use the cpp macro 'LINE'. |
- Returns
- none.
carma::util::SystemException::SystemException |
( |
std::ostringstream & |
message, |
|
|
const char * |
sysMessage = strerror(errno) , |
|
|
const char * |
fileName = __FILE__ , |
|
|
const int |
lineNum = __LINE__ |
|
) |
| |
Constructor - creates an instance of class SystemException.
- Parameters
-
message | An object of class ostringstream containing the message to be logged. If the exception is to be caught outside the scope of the function where the exception was constructed, then 'message' should not be a stack variable. Stack variables are lost as the exception unwinds stacks on its way to the catcher. |
sysMessage | The system error message to be logged for this exception. If the exception is to be caught outside the scope of the function where the exception was constructed, then 'sysMesg' should not be a stack variable. Stack variables are lost as the exception unwinds stacks on its way to the catcher. |
fileName | The source file containing the code throwing the exception - can be set using the cpp macro 'FILE'. |
lineNum | The line number in the source file where the exception is created - should use the cpp macro 'LINE'. |
- Returns
- none.
carma::util::SystemException::SystemException |
( |
std::ostringstream & |
message, |
|
|
const std::ostringstream |
sysMessage = std::ostringstream(strerror(errno)) , |
|
|
const char * |
fileName = __FILE__ , |
|
|
const int |
lineNum = __LINE__ |
|
) |
| |
Constructor - creates an instance of class SystemException.
- Parameters
-
message | An object of class std::ostringstream containing the message to be logged. If the exception is to be caught outside the scope of the function where the exception was constructed, then 'message' should not be a stack variable. Stack variables are lost as the exception unwinds stacks on its way to the catcher. |
sysMessage | An object of class ostringstream containing the system error message to be logged. If the exception is to be caught outside the scope of the function where the exception was constructed, then 'sysMessage' should not be a stack variable. Stack variables are lost as the exception unwinds stacks on its way to the catcher. |
fileName | The source file containing the code throwing the exception - can be set using the cpp macro 'FILE'. |
lineNum | The line number in the source file where the exception is created - should use the cpp macro 'LINE'. |
- Returns
- none.
carma::util::SystemException::SystemException |
( |
std::string & |
istring, |
|
|
const std::string |
sysMessage = strerror(errno) , |
|
|
const char * |
fileName = __FILE__ , |
|
|
const int |
lineNum = __LINE__ |
|
) |
| |
Constructor - creates an instance of class SystemException.
- Parameters
-
istring | An object of class string containing the message to be logged. If the exception is to be caught outside the scope of the function where the exception was constructed, then 'istring' should not be a stack variable. Stack variables are lost as the exception unwinds stacks on its way to the catcher. |
sysMessage | An object of class ostringstream containing the system error message to be logged. If the exception is to be caught outside the scope of the function where the exception was constructed, then 'sysMessage' should not be a stack variable. Stack variables are lost as the exception unwinds stacks on its way to the catcher. |
fileName | The source file containing the code throwing the exception - can be set using the cpp macro 'FILE'. |
lineNum | The line number in the source file where the exception is created - should use the cpp macro 'LINE'. |
- Returns
- none.
virtual carma::util::SystemException::~SystemException |
( |
| ) |
|
throw | ( | |
| ) | | |
|
virtual |
virtual const char* carma::util::SystemException::getSysMessage |
( |
| ) |
const |
|
virtual |
gets error message set within this instance.
getSysMessage - gets error message set within this instance of class SystemException. This message may be logged when the exception is caught. sysMesg__ is set using strerror( ) in the constructor.
- Returns
- error message as a constant char*.
The documentation for this class was generated from the following file: