# cException Class Reference
[Utility classes]

`#include <cexception.h>`

Inheritance diagram for cException:

List of all members.

## Detailed Description

Exception class.

## Public Member Functions

Constructors, destructor
| cException ()
| cException (int errcode,...)
| cException (const char *msg,...)
| cException (const cObject *where, int errcode,...)
| cException (const cObject *where, const char *msg,...)
virtual | ~cException ()
Getting exception info
int | errorCode ()
const char * | message ()
const char * | moduleClassName ()
const char * | moduleFullPath ()
int | moduleID ()

## Protected Member Functions

void | init (const cObject *obj, int errc, const char *fmt, va_list va)

## Constructor & Destructor Documentation

cException::cException | ( |  | ) |

| Default constructor.

cException::cException | ( | int | 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,
|  | int | 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 | ( |  | ) | `[inline, virtual]`

| Destructor.

## Member Function Documentation

int cException::errorCode | ( |  | ) | `[inline]`

| Returns the error code.

void cException::init | ( | const cObject * | obj,
|  | int | errc,
|  | const char * | fmt,
|  | va_list | va
| ) | `[protected]`

| Helper function for constructors: assembles and stores the message text. If obj is non-NULL, the message text will be prepended (if needed) with the object type and name, like this: "(cArray)array: ..."

const char* cException::message | ( |  | ) | `[inline]`

| Returns the text of the error.

const char* cException::moduleClassName | ( |  | ) | `[inline]`

| Returns the class name (NED type name) of the module where the exception occurred.

const char* cException::moduleFullPath | ( |  | ) | `[inline]`

| Returns the full path of the module where the exception occurred.

int cException::moduleID | ( |  | ) | `[inline]`

| 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).

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

- cexception.h