CARMA C++
carma::util::ErrorException Class Reference

Exception class for errors The exception comes with a text string that can be printed or logged. More...

#include <carma/util/ErrorException.h>

Inheritance diagram for carma::util::ErrorException:
carma::util::BaseException carma::dbms::DBConnectionException carma::dbms::MalformedSyslogLineException carma::dbms::MPMLException carma::dbms::SQLException carma::monitor::NullEventException carma::monitor::ReachedNumThresholdLimitException carma::monitor::ThresholdObjectNotFoundException carma::services::ConformabilityException carma::services::EphemerisException carma::services::UnsupportedCoordSysException carma::util::EOFException carma::util::FileExistsException carma::util::IllegalArgumentException carma::util::IllegalStateException carma::util::NotFoundException carma::util::NumberFormatException carma::util::SemaphoreException carma::util::SemaphoreTimedOutException

Public Member Functions

 ErrorException (const std::string &msg, const char *filename, int lineNo)
 Constructor. More...
 
 ErrorException (const std::ostringstream &msg, const char *filename, int lineNo)
 Constructor. More...
 
 ErrorException (const ErrorException &errorException)
 Copy constructor Very important for an exception, as it is actually a copy of the exception that is transported up to the catch();. More...
 
std::string getErrorMessage () const
 Get the full error message, including line number and file name. More...
 
virtual ::std::string getLogString () const
 
void log (log4cpp::Priority::PriorityLevel priority) const
 Log the exception. More...
 
ErrorExceptionoperator= (const ErrorException &rhs)
 
void report () const
 Report error to standard err. More...
 
virtual const char * what () const throw ()
 Get the error message; overrides BaseException & std::exception.what() More...
 
virtual ~ErrorException () throw ()
 Destructor. More...
 
- Public Member Functions inherited from carma::util::BaseException
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 ~BaseException () throw ( )
 

Protected Member Functions

 ErrorException ()
 Default constructor. More...
 
- Protected Member Functions inherited from carma::util::BaseException
 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)
 
BaseExceptionoperator= (const BaseException &rhs)
 
virtual void setLineNumber (int num)
 
void setSourceFileDirectly (const char *file)
 
void setSourceFileToCopy (const char *file)
 
void setSourceFileToCopy (const ::std::string &file)
 

Additional Inherited Members

Detailed Description

Exception class for errors The exception comes with a text string that can be printed or logged.

Definition at line 53 of file ErrorException.h.

Constructor & Destructor Documentation

carma::util::ErrorException::ErrorException ( const std::string &  msg,
const char *  filename,
int  lineNo 
)

Constructor.

Parameters
msgThe message for this exception.
filenameThe source file containing the code throwing the exception.
lineNoThe line number in the source file where the exception is created.
carma::util::ErrorException::ErrorException ( const std::ostringstream &  msg,
const char *  filename,
int  lineNo 
)

Constructor.

Parameters
msgThe message for this exception. Make sure that the stream has been terminated with "<< ends";
filenameThe source file containing the code throwing the exception. Can be set using the cpp macro 'FILE'.
lineNoThe line number in the source file where the exception is created. Can be set using the cpp macro 'LINE'.
carma::util::ErrorException::ErrorException ( const ErrorException errorException)

Copy constructor Very important for an exception, as it is actually a copy of the exception that is transported up to the catch();.

virtual carma::util::ErrorException::~ErrorException ( )
throw (
)
virtual

Destructor.

carma::util::ErrorException::ErrorException ( )
explicitprotected

Default constructor.

Member Function Documentation

std::string carma::util::ErrorException::getErrorMessage ( ) const

Get the full error message, including line number and file name.

Returns
full error message
void carma::util::ErrorException::log ( log4cpp::Priority::PriorityLevel  priority) const

Log the exception.

Parameters
prioritylog4cpp priority of error.
void carma::util::ErrorException::report ( ) const

Report error to standard err.

Reports error to standard error by printing the error message, filename and line number.

virtual const char* carma::util::ErrorException::what ( ) const
throw (
)
virtual

Get the error message; overrides BaseException & std::exception.what()

Reimplemented from carma::util::BaseException.


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