Exception class. More...
#include <cexception.h>
Public Member Functions | |
Constructors, destructor | |
| cException (OppErrorCode errcode,...) | |
| cException (const char *msg,...) | |
| cException (const cObject *where, OppErrorCode errcode,...) | |
| cException (const cObject *where, const char *msg,...) | |
| cException (const cException &) | |
| virtual cException * | dup () const |
| virtual | ~cException () throw () |
Updating the exception message | |
| virtual void | setMessage (const char *txt) |
| virtual void | prependMessage (const char *txt) |
Getting exception info | |
| virtual bool | isError () const |
| virtual int | getErrorCode () const |
| virtual const char * | what () const throw () |
| virtual std::string | getFormattedMessage () const |
| virtual int | getSimulationStage () const |
| virtual eventnumber_t | getEventNumber () const |
| virtual simtime_t | getSimtime () const |
| virtual bool | hasContext () const |
| virtual const char * | getContextClassName () const |
| virtual const char * | getContextFullPath () const |
| virtual int | getModuleID () const |
Protected Member Functions | |
| void | init (const cObject *obj, OppErrorCode errorcode, const char *fmt, va_list va) |
Exception class.
| cException::cException | ( | OppErrorCode | errcode, | |
| ... | ||||
| ) |
Error is identified by an error code, and the message comes from a string table.
The error string may expect printf-like arguments (s, d) which also have to be passed to the constructor.
| cException::cException | ( | const char * | msg, | |
| ... | ||||
| ) |
To be called like printf().
The error code is set to eCUSTOM.
| cException::cException | ( | const cObject * | where, | |
| OppErrorCode | errcode, | |||
| ... | ||||
| ) |
Error is identified by an error code, and the message comes from a string table.
The error string may expect printf-like arguments (s, d) which also have to be passed to the constructor. The 1st arg is the object where the error occurred: its class and object name will be prepended to the message like this: "(cArray)arr".
| cException::cException | ( | const cObject * | where, | |
| const char * | msg, | |||
| ... | ||||
| ) |
To be called like printf().
The error code is set to eCUSTOM. The 1st arg is the object where the error occurred: its class and object name will be prepended to the message like this: "(cArray)arr".
| virtual cException* cException::dup | ( | ) | const [inline, virtual] |
Virtual copy constructor.
We unfortunately need to copy exception objects when handing them back from an activity().
Reimplemented in cTerminationException, cRuntimeError, cDeleteModuleException, and cStackCleanupException.
| virtual int cException::getModuleID | ( | ) | const [inline, virtual] |
Returns the ID of the module where the exception occurred, or -1 if it was not inside a module.
The module may not exist any more when the exception is caught (ie. if the exception occurs during network setup, the network is cleaned up immediately).
| virtual bool cException::hasContext | ( | ) | const [inline, virtual] |
Returns true if the exception has "context info", that is, it occurred within a known module or channel.
getContextClassName(), getContextFullPath() and getModuleID() may only be called if this method returns true.
| void cException::init | ( | const cObject * | obj, | |
| OppErrorCode | errorcode, | |||
| const char * | fmt, | |||
| va_list | va | |||
| ) | [protected] |
Helper function for constructors: assembles and stores the message text.
If the first arg is non-NULL, the message text will be prepended (if needed) with the object type and name, like this: "(cArray)array: ..."
| virtual bool cException::isError | ( | ) | const [inline, virtual] |
Whether the exception represents an error or a normal (non-error) terminating condition (e.g.
"Simulation completed").
Reimplemented in cTerminationException, cDeleteModuleException, and cStackCleanupException.
| virtual const char* cException::what | ( | ) | const throw () [inline, virtual] |
Returns the text of the error.
Redefined from std::exception.
1.6.3