exceptions4c   version 3.0
An exception handling framework for C
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
e4c_exception Struct Reference

Represents an instance of an exception type. More...

Data Fields

const char * name
 The name of this exception. More...
 
char message [E4C_EXCEPTION_MESSAGE_SIZE]
 The message of this exception. More...
 
const char * file
 The path of the source code file from which the exception was thrown. More...
 
int line
 The number of line from which the exception was thrown. More...
 
const char * function
 The function from which the exception was thrown. More...
 
int error_number
 The value of errno at the time the exception was thrown. More...
 
const e4c_exception_typetype
 The type of this exception. More...
 
e4c_exceptioncause
 The cause of this exception. More...
 
void * custom_data
 Custom data associated to this exception. More...
 

Detailed Description

Represents an instance of an exception type.

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.

Exceptions provide information regarding the exceptional situation, such as:

  • The exception name
  • An ad-hoc message (as opposed to the default one)
  • The exact point of the program where it was thrown (source code file, line and function name, if available)
  • The value of the standard error code errno at the time the exception was thrown
  • The cause of the exception, which is the previous exception (if any), when the exception was thrown
  • The specific type of the exception, convenient when handling an abstract type of exceptions from a catch block
  • Optional, user-defined, custom_data, which can be initialized and finalized throught context handlers
Note
Any exception can be caught by a block introduced by catch(RuntimeException), except for AssertionException.
See Also
e4c_exception_type
throw
catch
e4c_get_exception
e4c_context_set_handlers
RuntimeException
AssertionException

Field Documentation

e4c_exception* e4c_exception::cause

The cause of this exception.

void* e4c_exception::custom_data

Custom data associated to this exception.

int e4c_exception::error_number

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.

const char* e4c_exception::function

The function from which the exception was thrown.

int e4c_exception::line

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.

const e4c_exception_type* e4c_exception::type

The type of this exception.


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