Data Fields

e4c_exception Struct Reference

Represents an exception in the exception handling system. More...

Data Fields

const char * name
 The name of this exception.
char message [E4C_EXCEPTION_MESSAGE_SIZE]
 The message of this exception.
const e4c_exceptionsuper
 The supertype of this exception.
const char * file
 The path of the source code file from which the exception was thrown.
int line
 The number of line from which the exception was thrown.
const char * function
 The function from which the exception was thrown.
int error_number
 The value of errno at the time the exception was thrown.
const e4c_exceptiontype
 The class of this exception.
const e4c_exceptioncause
 The cause of this exception.

Detailed Description

Represents an exception in the exception handling system.

Exceptions are a means of breaking out of the normal flow of control of a code block in order to handle errors or other exceptional conditions. An exception should be thrown at the point where the error is detected; it may be handled by the surrounding code block or by any code block that directly or indirectly invoked the code block where the error occurred.

The types of the exceptions a program will use are defined through the macro E4C_DEFINE_EXCEPTION:

 E4C_DEFINE_EXCEPTION(StackException, "Stack overflow", RuntimeException);
 E4C_DEFINE_EXCEPTION(StackOverflowException, "Stack overflow", StackException);
 E4C_DEFINE_EXCEPTION(StackUnderflowException, "Stack underflow", StackException);
 

When defining types of exceptions, they are given a name, a default message and a supertype to organize them into a pseudo-hierarchy. These can be considered as the compile-time attributes of a exception.

However, exceptions provide further information regarding the exceptional situation at run-time, such as:

Exceptions are usually defined as global objects. There is a set of predefined exceptions built into the framework, amongst others:

RuntimeException is the root of the exceptions pseudo-hierarchy. Any exception can be caught by a catch(RuntimeException) block, except AssertionException.

See also:
E4C_DEFINE_EXCEPTION
E4C_DECLARE_EXCEPTION
RuntimeException
AssertionException
throw
catch
e4c_get_exception

Field Documentation

The cause of this exception.

The value of errno at the time the exception was thrown.

const char* e4c_exception::file

The path of the source code file from which the exception was thrown.

The function from which the exception was thrown.

The number of line from which the exception was thrown.

char e4c_exception::message[E4C_EXCEPTION_MESSAGE_SIZE]

The message of this exception.

const char* e4c_exception::name

The name of this exception.

The supertype of this exception.

The class of this exception.


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

exceptions4c version 2.3
Copyright 2010 Guillermo Calvo.

Generated on Wed Nov 24 2010 by doxygen 1.7.2