#include <cexception.h>
|
void | init (const cObject *obj, ErrorCode errorcode, const std::string &msg) |
|
◆ cException() [1/5]
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() [2/5]
To be called like printf(). The error code is set to E_CUSTOM.
◆ cException() [3/5]
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() [4/5]
To be called like printf(). The error code is set to E_CUSTOM. 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() [5/5]
Copy constructor. We unfortunately need to copy exception objects when handing them back from an activity() method.
◆ ~cException()
◆ init()
void init |
( |
const cObject * |
obj, |
|
|
ErrorCode |
errorcode, |
|
|
const std::string & |
msg |
|
) |
| |
|
protected |
Helper function for constructors: assembles and stores the message text. If the first arg is non-nullptr, the message text will be prepended (if needed) with the object type and name, like this: "(cArray)array: ..."
◆ dup()
◆ setMessage()
virtual void setMessage |
( |
const char * |
txt | ) |
|
|
inlinevirtual |
Overwrites the message text with the given one.
◆ prependMessage()
virtual void prependMessage |
( |
const char * |
txt | ) |
|
|
inlinevirtual |
Prefixes the message with the given text and a colon.
◆ isError()
virtual bool isError |
( |
| ) |
const |
|
inlinevirtual |
◆ getErrorCode()
virtual int getErrorCode |
( |
| ) |
const |
|
inlinevirtual |
◆ what()
virtual const char* what |
( |
| ) |
const |
throw | ( | |
| ) | | |
|
inlineoverridevirtual |
Returns the text of the error. Redefined from std::exception.
◆ getFormattedMessage()
virtual std::string getFormattedMessage |
( |
| ) |
const |
|
virtual |
Returns a formatted message that includes the "Error" word, context information, the event number and simulation time if available and relevant, in addition to the exception message (what()).
◆ getSimulationStage()
virtual int getSimulationStage |
( |
| ) |
const |
|
inlinevirtual |
Returns in which stage of the simulation the exception object was created: during network building (CTX_BUILD), network initialization (CTX_INITIALIZE), simulation execution (CTX_EVENT), finalization (CTX_FINISH), or network cleanup (CTX_CLEANUP).
◆ getEventNumber()
Returns the event number at the creation of the exception object.
◆ getSimtime()
Returns the simulation time at the creation of the exception object.
◆ hasContext()
virtual bool hasContext |
( |
| ) |
const |
|
inlinevirtual |
◆ getContextClassName()
virtual const char* getContextClassName |
( |
| ) |
const |
|
inlinevirtual |
Returns the class name (NED type name) of the component in context when the exception occurred.
◆ getContextFullPath()
virtual const char* getContextFullPath |
( |
| ) |
const |
|
inlinevirtual |
Returns the full path of the component in context when the exception occurred.
◆ getContextComponentId()
virtual int getContextComponentId |
( |
| ) |
const |
|
inlinevirtual |
Returns the ID of the component in context when the exception occurred, or -1 if there was no component in context. The component may not exist any more when the exception is caught (ie. if the exception occurs during network setup, the network is cleaned up immediately).
◆ getContextComponentKind()
virtual int getContextComponentKind |
( |
| ) |
const |
|
inlinevirtual |
Returns the kind of the component in context when the exception occurred. (The return value can be safely cast to cComponent::ComponentKind.)
The documentation for this class was generated from the following file: