except4c.h File Reference

exceptions4c header file More...

#include <stdlib.h>
#include <setjmp.h>

Data Structures

struct  Exception
 Represents an exception in the exception handling system. More...
struct  SignalMapping
 Represents a map between a signal and an exception. More...
struct  ExceptionFrame
 Represents a frame inside an exception context. More...
struct  ExceptionContext
 Represents the exception context of the program. More...

Defines

Exception handling keywords

This is a set of keywords which map the semantics of exception handling.

#define try
 Introduces a block of code aware of exceptions.
#define catch(_exception_)
 Introduces a block of code capable of handling a specific kind of exceptions.
#define finally
 Introduces a block of code responsible for cleaning up the previous try block.
#define throw(_exception_)
 Signals an exceptional situation represented by an exception object.
Convenience macros for acessing exception-related information

These macros let you obtain data regarding the current exception context, such as the actual exception being thrown, the value of errno, etc.

This information is especially useful when recovering from errors (catch blocks) or cleaning up (finally blocks).

#define E4C_CONTEXT   getExceptionContext()
 Accesses the current exception context of the program (or current thread).
#define EC4_FRAME   (E4C_CONTEXT->currentFrame)
 Accesses the current frame of the exception context.
#define EXCEPTION   (EC4_FRAME->exception)
 Accesses the current exception being thrown from the current exception frame.
#define EC4_ERRNO   (EC4_FRAME->errorNumber)
 Accesses the error number of the current exception frame.
#define EC4_FILE   (EC4_FRAME->srcFile)
 Accesses the error file of the current exception frame.
#define EC4_LINE   (EC4_FRAME->srcLine)
 Accesses the error line of the current exception frame.
#define EC4_STATUS_THROWN   (EC4_FRAME->thrown)
 Accesses the thrown flag of the current exception frame.
#define EC4_STATUS_UNCAUGHT   (EC4_FRAME->uncaught)
 Accesses the uncaught flag of the current exception frame.
#define EC4_SUCCEED   (!EC4_STATUS_THROWN)
 Checks whether the current exception frame did complete without an error.
#define EC4_RECOVERED   (EC4_STATUS_THROWN && !EC4_STATUS_UNCAUGHT)
 Checks whether the current exception frame did fail and then did recover of the error.
#define EC4_FAILED   (EC4_STATUS_THROWN && EC4_STATUS_UNCAUGHT)
 Checks whether the current exception frame did fail and did not recover of the error.
Dispose pattern keywords

This is a set of keywords which map the semantics of automatic resource acquisition and disposal.

#define with(_resource_, _dispose_)
 Opens a block of code with automatic disposal of a resource.
#define use
 Closes a block of code with automatic disposal of a resource.
#define using(_type_, _resource_, _args_)
 Introduces a block of code with automatic acquisition and disposal of a resource.
Convenience macros for acquiring and disposing resources

These macros let you acquire and dispose different kinds of resources according to the dispose pattern.

#define acquireMemory   malloc
 Binds the acquisition of memory to the standard function malloc.
#define disposeMemory(_buffer_, _failure_, _context_)   free(_buffer_)
 Binds the disposal of memory to the standard function malloc.
#define usingMemory(_buffer_, _bytes_)
 Introduces a block of code with automatic acquisition and disposal of a memory buffer.
#define acquireFile   fopen
 Binds the acquisition of file to the standard function fopen.
#define disposeFile(_file_, _failure_, _context_)   fclose(_file_)
 Binds the disposal of memory to the standard function fclose.
#define usingFile(_file_, _path_, _mode_)
 Introduces a block of code with automatic acquisition and disposal of a file stream.
#define usingIf(_type_, _resource_, _args_, _cond_, _exception_)
 Introduces a block of code with automatic disposal of a resource and acquisition, under certain condition.
#define usingIfNotNull(_type_, _resource_, _args_, _exception_)
 Introduces a block of code with automatic disposal of a resource and acquisition, preventing null pointers.
Other convenience macros

These macros let you represent and define Exception and SignalMapping literals and variables.

#define DEFINE_EXCEPTION(_name_, _description_, _super_)
 Defines a new, const exception.
#define SIGNAL_MAPPING(_signalNumber_, _exception_)
 Represents a mapping literal.

Typedefs

typedef void(* UncaughtHandler )(Exception exception, const char *srcFile, int srcLine, int errorNumber)
 This is the signature of a function which will be executed in the event of an uncaught exception.

Enumerations

enum  e4c_Stage {
  e4c_begin, e4c_acquire, e4c_try, e4c_dispose,
  e4c_catch, e4c_finalize, e4c_end
}
 

Represents the current execution status of an exception frame.

More...

Functions

void beginExceptionContext (unsigned char handleSignals, UncaughtHandler uncaughtHandler)
 Opens an exception context.
ExceptionContextgetExceptionContext ()
 Retrieves the current exception context of the program (or current thread).
void endExceptionContext ()
 Closes the current exception context.
void setSignalHandlers (const SignalMapping *mapping, int mappings)
 Sets up the signal handling system.
void initializeExceptionContext (ExceptionContext *context)
 Initializes new exception context.
const Exception newException (const char *name, const char *description, const Exception *super)
 Creates a new exception.
void dumpException (Exception exception, const char *srcFile, int srcLine, int errorNumber)
 Prints a fatal error message regarding the specified exception.
void printExceptionHierarchy (Exception exception)
 Prints an exception's hierarchy graph.

Variables

Predefined exceptions

Built-in exceptions represent usual error conditions that might occur during the course of any program.

They are organized into a pseudo-hierarchy, being RuntimeException the common supertype of all exceptions.

const Exception INVALID_EXCEPTION
 This represents an invalid exception.
const Exception RuntimeException
 This is the root of the exception pseudo-hierarchy.
const Exception NotEnoughMemoryException
 This exception is thrown when the system runs out of memory.
const Exception NullPointerException
 This exception is thrown when an unexpected null pointer is found.
const Exception FileOpenException
 This exception is thrown when a file cannot be opened.
const Exception SignalException
 This exception is the common supertype of all signal exceptions.
const Exception SignalAlarmException
 This exception is thrown when a time limit has elapsed.
const Exception SignalChildException
 This exception is thrown when a child process terminates.
const Exception SignalTrapException
 This exception is thrown when a condition arises that a debugger has requested to be informed of.
const Exception ErrorSignalException
 This exception is the common supertype of all error signal exceptions.
const Exception IllegalInstructionException
 This exception is thrown when the process attempts to execute an illegal instruction.
const Exception ArithmeticException
 This exception is thrown when the process performs an erroneous arithmetic operation.
const Exception BadPointerException
 This exception is thrown when the process tries to dereference an invalid pointer.
const Exception BrokenPipeException
 This exception is thrown when the process attempts to write to a broken pipe.
const Exception ControlSignalException
 This exception is the common supertype of all control signal exceptions.
const Exception StopException
 This exception is thrown to stop the process for later resumption.
const Exception KillException
 This exception is thrown to terminate the process immediately.
const Exception HangUpException
 This exception is thrown when the process' terminal is closed.
const Exception TerminationException
 This exception is thrown to request the termination of the process.
const Exception AbortException
 This exception is thrown to abort the process.
const Exception CPUTimeException
 This exception is thrown when the process has used up the CPU for too long.
const Exception UserControlSignalException
 This exception is the common supertype of all control signal exceptions caused by the user.
const Exception UserQuitException
 This exception is thrown when the user requests to quit the process.
const Exception UserInterruptionException
 This exception is thrown when the user requests to interrupt the process.
const Exception UserBreakException
 This exception is thrown when a user wishes to break the process.
const Exception ProgramSignalException
 This exception is the common supertype of all user-defined signal exceptions.
const Exception ProgramSignal1Exception
 This exception is thrown when user-defined conditions occur.
const Exception ProgramSignal2Exception
 This exception is thrown when user-defined conditions occur.

Detailed Description

exceptions4c header file

Version:
1.3
Author:
Copyright (c) 2010 Guillermo Calvo

exceptions4c header file

This header file needs to be included from in order to be able to use any of the keywords of the the exception handling system:

License

This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this software. If not, see <http://www.gnu.org/licenses/>.


Define Documentation

#define acquireFile   fopen

Binds the acquisition of file to the standard function fopen.

#define acquireMemory   malloc

Binds the acquisition of memory to the standard function malloc.

#define catch ( _exception_   ) 
Value:
else if( \
              e4c_hook(e4c_catch, _exception_) \
       )

Introduces a block of code capable of handling a specific kind of exceptions.

Parameters:
_exception_ The kind of exceptions to be handled
#define DEFINE_EXCEPTION ( _name_,
_description_,
_super_   ) 
Value:
const Exception _name_ = { \
              name: #_name_, description: _description_, super: &_super_ \
       }

Defines a new, const exception.

Parameters:
_name_ Name of the new exception
_description_ Description of the new exception
_super_ Supertype of the new exception
See also:
Exception
#define disposeFile ( _file_,
_failure_,
_context_   )     fclose(_file_)

Binds the disposal of memory to the standard function fclose.

#define disposeMemory ( _buffer_,
_failure_,
_context_   )     free(_buffer_)

Binds the disposal of memory to the standard function malloc.

#define E4C_CONTEXT   getExceptionContext()

Accesses the current exception context of the program (or current thread).

See also:
ExceptionContext
getExceptionContext
beginExceptionContext
endExceptionContext
#define EC4_ERRNO   (EC4_FRAME->errorNumber)

Accesses the error number of the current exception frame.

See also:
ExceptionFrame
#define EC4_FAILED   (EC4_STATUS_THROWN && EC4_STATUS_UNCAUGHT)

Checks whether the current exception frame did fail and did not recover of the error.

See also:
ExceptionFrame
#define EC4_FILE   (EC4_FRAME->srcFile)

Accesses the error file of the current exception frame.

See also:
ExceptionFrame
#define EC4_FRAME   (E4C_CONTEXT->currentFrame)

Accesses the current frame of the exception context.

See also:
ExceptionFrame
#define EC4_LINE   (EC4_FRAME->srcLine)

Accesses the error line of the current exception frame.

See also:
ExceptionFrame
#define EC4_RECOVERED   (EC4_STATUS_THROWN && !EC4_STATUS_UNCAUGHT)

Checks whether the current exception frame did fail and then did recover of the error.

See also:
ExceptionFrame
#define EC4_STATUS_THROWN   (EC4_FRAME->thrown)

Accesses the thrown flag of the current exception frame.

The thrown flag is set when some exception is thrown within the current exception frame, regardless of whether it gets caught or not.

See also:
ExceptionFrame
EC4_STATUS_UNCAUGHT
#define EC4_STATUS_UNCAUGHT   (EC4_FRAME->uncaught)

Accesses the uncaught flag of the current exception frame.

The uncaught flag is set when some exception is caught within the current exception frame.

See also:
ExceptionFrame
EC4_STATUS_THROWN
#define EC4_SUCCEED   (!EC4_STATUS_THROWN)

Checks whether the current exception frame did complete without an error.

See also:
ExceptionFrame
#define EXCEPTION   (EC4_FRAME->exception)

Accesses the current exception being thrown from the current exception frame.

If no exception was thrown, then the value of EXCEPTION will be INVALID_EXCEPTION.

The flag EC4_STATUS_THROWN can be checked in order to know if an exception was actually thrown.

See also:
ExceptionFrame
INVALID_EXCEPTION
EC4_STATUS_THROWN
#define finally
Value:
else if( \
              e4c_hook(e4c_finalize, INVALID_EXCEPTION) \
       )

Introduces a block of code responsible for cleaning up the previous try block.

#define SIGNAL_MAPPING ( _signalNumber_,
_exception_   ) 
Value:
{ \
              signalNumber:   _signalNumber_, \
              exception:      &_exception_, \
       }

Represents a mapping literal.

Parameters:
_signalNumber_ Signal to be converted
_exception_ Exception representing the signal
See also:
SignalMapping
#define throw ( _exception_   ) 
Value:
e4c_throw( \
              _exception_, E4C_FILE, E4C_LINE \
       )

Signals an exceptional situation represented by an exception object.

Parameters:
_exception_ The exception to be thrown
#define try
Value:
E4C_LOOP(e4c_acquire) \
       if( e4c_hook(e4c_try, INVALID_EXCEPTION) \
              && e4c_next() )

Introduces a block of code aware of exceptions.

#define use
Value:
}else if( \
              e4c_hook(e4c_try, INVALID_EXCEPTION) \
       )

Closes a block of code with automatic disposal of a resource.

A use block must always be preceded by a with block. Dangling with or use blocks will (hopefully) make the compiler complain.

See also:
with
#define using ( _type_,
_resource_,
_args_   ) 
Value:
with(_resource_, dispose##_type_) \
              _resource_ = acquire##_type_ _args_; \
       use

Introduces a block of code with automatic acquisition and disposal of a resource.

Parameters:
_type_ The type of the resource
_resource_ The resource to be acquired, used and then disposed
_args_ A list of arguments to be passed to acquisition function

The specified resource will be aquired, used and then disposed. The automatic acquisition and disposal is achieved by calling the magic functions:

  • _type_ acquire_type_(_args_)
  • void dispose_type_(_resource_, failed, context)

The resource will be acquired implicitly by assigning it the result of the magic acquisition function acquire_type_.

The semantics of the automatic acquisition and disposal are the same as for blocks introduced by the keyword with.

See also:
with
usingIfNotNull
usingMemory
usingFile
#define usingFile ( _file_,
_path_,
_mode_   ) 
Value:
usingIfNotNull( \
              File, _file_, (_path_, _mode_), FileOpenException \
       )

Introduces a block of code with automatic acquisition and disposal of a file stream.

Parameters:
_file_ The file to be acquired, used and then disposed
_path_ The path of the file to be opened
_mode_ The access mode of the file

This macro lets you acquire and dispose (open and close) files according to the dispose pattern:

 FILE * file;
  
 usingFile(file, "log.txt", "a"){
     /* implicit: file = fopen("log.txt", "a"); */
     fputs("hello, world!\n", file);
     /* implicit: fclose(file); */
 }
 

If fopen returns NULL then the exception FileOpenException will be automatically thrown.

The macro EC4_ERRNO can be checked in order to find out the specific cause of the error.

#define usingIf ( _type_,
_resource_,
_args_,
_cond_,
_exception_   ) 
Value:
with(_resource_, dispose##_type_){ \
              _resource_ = acquire##_type_ _args_; \
              if( !(_cond_) ) throw(_exception_); \
       }use

Introduces a block of code with automatic disposal of a resource and acquisition, under certain condition.

Parameters:
_type_ The type of the resource
_resource_ The resource to be acquired, used and then disposed
_args_ A list of arguments to be passed to acquisition function
_cond_ The condition which has to be satisfied in order to consider the acquisition complete
_exception_ The exception to be thrown if the acquisition function does not satisfy the specified condition

This macro will attempt the acquisition of the resource and then will check the given condition. If the condition evaluates to false, then the specified exception will be thrown, and therefore, the disposal of the resource will not take place.

This is a convenience macro for reusing legacy C standard functions which don't throw exceptions when the acquisition fails. For example:

 # define acquireMemory malloc
 # define disposeMemory free
 # define usingMemory(_resource_, _bytes_) \
          usingIf(Memory, _resource_, ( _bytes_ ), _resource_ != NULL, \
          NotEnoughMemoryException )
 
See also:
using
#define usingIfNotNull ( _type_,
_resource_,
_args_,
_exception_   ) 
Value:
usingIf( \
              _type_, _resource_, _args_, _resource_ != NULL, _exception_ \
       )

Introduces a block of code with automatic disposal of a resource and acquisition, preventing null pointers.

Parameters:
_type_ The type of the resource
_resource_ The resource to be acquired, used and then disposed
_args_ A list of arguments to be passed to acquisition function
_exception_ The exception to be thrown if the acquisition function yields a NULL pointer.
See also:
usingIf
#define usingMemory ( _buffer_,
_bytes_   ) 
Value:
usingIfNotNull( \
              Memory, _buffer_, (_bytes_), NotEnoughMemoryException \
       )

Introduces a block of code with automatic acquisition and disposal of a memory buffer.

Parameters:
_buffer_ The buffer to be acquired, used and then disposed
_bytes_ The amount of memory to be allocated (in bytes)

This macro lets you acquire and dispose memory according to the dispose pattern:

 void * buffer;
  
 usingMemory(buffer, 1024){
     /* implicit: buffer = malloc(1024); */
     memset(buffer, 0, 1024);
     /* implicit: free(buffer); */
 }
 

If malloc returns NULL then the exception NotEnoughMemoryException will be automatically thrown.

#define with ( _resource_,
_dispose_   ) 
Value:
E4C_LOOP(e4c_begin) \
       if( e4c_hook(e4c_dispose, INVALID_EXCEPTION) ){ \
              ExceptionContext * context = E4C_CONTEXT; \
              _dispose_(_resource_, context->currentFrame->thrown, context); \
       }else if( e4c_hook(e4c_acquire, INVALID_EXCEPTION) ){

Opens a block of code with automatic disposal of a resource.

Parameters:
_resource_ The resource to be disposed
_dispose_ The name of the disposal function (or macro)

The with keyword is used to encapsulate the Dispose Pattern. It must be followed by the use keyword.

In addition, the use block can precede catch and finally blocks.

This pattern consists of two separate blocks and an implicit call to a given function:

  1. the with block is responsible of the resource acquisition
  2. the use block makes use of the resource
  3. the disposal function is called implicitly

The with keyword guarantees that the disposal function will be called if and only if the acquisition block completed without an error (i.e. no exteption being thrown from the acquisition block).

If the with does not complete, then neither the disposal function nor the use block will be ever executed.

The disposal function is called right after the use block. If an exception was thrown, the catch or finally blocks (if any) will take place after the disposal of the resource.

When called, the disposal function will receive three arguments:

  1. The resource
  2. A boolean flag indicating if the use block did not complete
  3. The current exception context

This way, different actions can be taken depending on the success or failure of the block. For example, commiting or rolling back a transaction resource.

Legacy functions can be reused by defining macros. For example, a file resource needs to be closed regardless of the errors. Since the function fclose only takes a parameter, we could provide disposeFile as the disposal function and define the next macro:

 # define disposeFile(_file_, _failed_, _context_) fclose(_file_)
 

The typical usage of a with block will be:

 with(foo, disposeFoo){
     foo = acquireFoo(foobar);
     someAssertion(foo, bar);
     ...
 }use{
     fooSomething(foo);
     ...
 }catch(FooAcquisitionFailed){
     recover1();
     ...
 }catch(somethingElseFailed){
     recover2();
     ...
 }finally{
     cleanup();
     ...
 }
 

Nonetheless, one-liners fit nicely too:

 with(foo, disposeFoo) foo = acquireFoo(bar, foobar); use fooSomething(foo);
 

There is a way to lighten up even more this pattern by defining convenience macros, customized for a specific kind of resources. For example, usingFile or usingMemory.

See also:
use
using
usingIfNotNull
usingMemory
usingFile

Typedef Documentation

typedef void(* UncaughtHandler)(Exception exception, const char *srcFile, int srcLine, int errorNumber)

This is the signature of a function which will be executed in the event of an uncaught exception.

These functions are not allowed to try and recover the current exception context. Moreover, the program (or current thread) will terminate right after the function returns.

Parameters:
exception The uncaught exception
srcFile The path of the source code file from which the exception was thrown
srcLine The number of line from which the exception was thrown
errorNumber The value of errno at the time the exception was thrown

Enumeration Type Documentation

enum e4c_Stage

Represents the current execution status of an exception frame.

Note: this type is internal to the framework, and not intended to be used by the user of the library.

Every group of try/catch/finally blocks goes through a set of execution stages. Each stage determines which one of the different blocks is run.

Enumerator:
e4c_begin 

No block has been executed yet.

e4c_acquire 

Acquiring a resource.

e4c_try 

Executing the "try" or "use" block.

e4c_dispose 

Disposing a resource.

e4c_catch 

Catching (or attempting to catch) an exception.

e4c_finalize 

Cleaning up ("finally" block).

e4c_end 

The group of blocks has been executed.


Function Documentation

void beginExceptionContext ( unsigned char  handleSignals,
UncaughtHandler  uncaughtHandler 
)

Opens an exception context.

This function creates and initializes the exception context to be used by the the program until endExceptionContext is called.

A function can be specified to be called in the event of an uncaught exception. There exceptions, if handleSignals is true.

In addition, if handleSignals is true, beginExceptionContext will sets u the default mapping to convert signals into exceptions. This goal is achieved through the standard function signal. Note that the behaviour of signal is undefined in a multithreaded program, so use this feature with caution.

Parameters:
handleSignals If true, the signal handling system will be set up with the default mapping.
uncaughtHandler If not NULL, this function will be called in the event of an uncaught exception.
void dumpException ( Exception  exception,
const char *  srcFile,
int  srcLine,
int  errorNumber 
)

Prints a fatal error message regarding the specified exception.

This is a convenience function for showing an error message through the standard error output. It can be passed to beginExceptionContext as the handler for uncaught exceptions.

Parameters:
exception The uncaught exception
srcFile The path of the source code file from which the exception was thrown
srcLine The number of line from which the exception was thrown
errorNumber The value of errno at the time the exception was thrown
void endExceptionContext (  ) 

Closes the current exception context.

This function closes the current exception context.

ExceptionContext* getExceptionContext (  ) 

Retrieves the current exception context of the program (or current thread).

The exception context must be properly started and finished by calling the functions beginExceptionContext and andExceptionContext in order to be accessed.

See also:
ExceptionContext
beginExceptionContext
endExceptionContext
E4C_CONTEXT
void initializeExceptionContext ( ExceptionContext context  ) 

Initializes new exception context.

This is a convenience function for creating a new exception context.

Parameters:
context Pointer to the new context to be initialized
const Exception newException ( const char *  name,
const char *  description,
const Exception super 
)

Creates a new exception.

This is a convenience function for creating a new exception.

Parameters:
name Name of the new exception
description Description of the new exception
super Address of the supertype of the new exception
void printExceptionHierarchy ( Exception  exception  ) 

Prints an exception's hierarchy graph.

This is a convenience function for printing an exception's hierarchy graph with simple ASCII characters.

Parameters:
exception The exception whose hierarchy is to be printed
void setSignalHandlers ( const SignalMapping mapping,
int  mappings 
)

Sets up the signal handling system.

This function receives an array of mappings between the signals to be handled and the corresponding exception to be thrown.

Parameters:
mapping The array of mappings
mappings The number of elements in the array

Variable Documentation

This exception is thrown to abort the process.

AbortException represents SIGABRT, the signal sent by computer programs to abort the process.

This exception is thrown when the process performs an erroneous arithmetic operation.

ArithmeticException represents SIGFPE, the signal sent to a process when it performs an erroneous arithmetic operation.

This exception is thrown when the process tries to dereference an invalid pointer.

BadPointerException represents SIGSEGV, the signal sent to a process when it makes an invalid memory reference, or segmentation fault.

This exception is thrown when the process attempts to write to a broken pipe.

BrokenPipeException represents SIGPIPE, the signal sent to a process when it attempts to write to a pipe without a process connected to the other end.

This exception is the common supertype of all control signal exceptions.

Control signal exceptions are thrown when the process needs to be controlled by the user or some other process.

This is the hierarchy of control signal exceptions:

This exception is thrown when the process has used up the CPU for too long.

CPUTimeException represents SIGXCPU, the signal sent to a process when it has used up the CPU for a duration that exceeds a certain predetermined user-settable value.

This exception is the common supertype of all error signal exceptions.

Error signal exceptions are thrown when some error prevents the program to keep executing its normal flow, for example:

This is the hierarchy of error signal exceptions:

This exception is thrown when a file cannot be opened.

FileOpenException is thrown by usingFile when fopen returns NULL for whatever reason.

The value of errno at the time the exception was thrown (right after fopen) can be accessed through the macro EC4_ERRNO.

This exception is thrown when the process' terminal is closed.

HangUpException represents SIGHUP, the signal sent to a process when its controlling terminal is closed.

This exception is thrown when the process attempts to execute an illegal instruction.

IllegalInstructionException represents SIGILL, the signal sent to a process when it attempts to execute a malformed, unknown, or privileged instruction.

This represents an invalid exception.

INVALID_EXCEPTION honors the Null Object pattern:

  • Throwing it has no effect
  • Catching it does nothing

This exception is thrown to terminate the process immediately.

KillException represents SIGKILL, the signal sent to a process to cause it to terminate immediately.

Since SIGKILL is unblock-able, it cannot be handled and converted to this exception automatically.

This exception is thrown when the system runs out of memory.

NotEnoughMemoryException is thrown when there is not enough memory to continue the execution of the program.

This exception is thrown when an unexpected null pointer is found.

NullPointerException is thrown when some part of the program gets a pointer which was expected or required to contain a valid memory address.

This exception is thrown when user-defined conditions occur.

ProgramSignal1Exception represents SIGUSR1, the signal sent to a process to indicate user-defined conditions.

This exception is thrown when user-defined conditions occur.

ProgramSignal2Exception represents SIGUSR1, the signal sent to a process to indicate user-defined conditions.

This exception is the common supertype of all user-defined signal exceptions.

User-defined signal exceptions are thrown to indicate user-defined conditions.

This is the hierarchy of user-defined signal exceptions:

This exception is thrown when a time limit has elapsed.

SignalAlarmException represents SIGALRM, the signal sent to a process when a time limit has elapsed.

This exception is thrown when a child process terminates.

SignalChildException represents SIGCHLD, the signal sent to a process when a child process terminates (ignored by default).

This exception is thrown when a condition arises that a debugger has requested to be informed of.

SignalTrapException represents SIGTRAP, the signal sent to a process when a condition arises that a debugger has requested to be informed of.

This exception is thrown to stop the process for later resumption.

StopException represents SIGSTOP, the signal sent to a process to stop it for later resumption.

Since SIGSTOP is unblock-able, it cannot be handled and converted to this exception automatically.

This exception is thrown to request the termination of the process.

TerminationException represents SIGTERM, the signal sent to a process to request its termination.

This exception is thrown when a user wishes to break the process.

UserBreakException represents SIGBREAK, the signal sent to a process by its controlling terminal when a user wishes to break it.

This exception is the common supertype of all control signal exceptions caused by the user.

User control signal exceptions are thrown when the process needs to be controlled by the user.

This is the hierarchy of control signal exceptions caused by the user:

This exception is thrown when the user requests to interrupt the process.

UserInterruptionException represents SIGINT, the signal sent to a process by its controlling terminal when a user wishes to interrupt it.

This exception is thrown when the user requests to quit the process.

UserQuitException represents SIGQUIT, the signal sent to a process by its controlling terminal when the user requests that the process dump core.


exceptions4c version 1.3
Copyright 2010 Guillermo Calvo.

Generated on 24 Jan 2010 by doxygen 1.6.2