# Exception Handler Class

Topics

:

Overview
Conditional Directives
Constants
Enumerations
Functions

Overview

The exception handler class is a general-purpose support class that can be used by applications to display exceptions that occur at run-time. The EHandler class is designed to work with several APIs and is a convenient way to code messaging functions when working with multiple GUI libraries. A global pointer to an EHandler class object, named ProgramError is provided to perform all the necessary messaging operations for the life of the program.

Conditional Directives

__wxWIN168B__

- Directive used for the wxWindows 1.68B GUI library.

__wxWIN201__

- Directive used for the wxWindows 2.0.1 and higher GUI library.

__CONSOLE__

- Directive used for console-based applications.

__CURSES__

- Directive used for the Curses library.

Constants

    const int FatalErrorLevel = 1; // Return value to the Operating System

Enumerations

    enum { // Exception Handler error levels
     EHandler::FATAL = 0x0010,  // Fatal error, terminate program immediately
     Ehandler::DISPLAY = 0x0020 // Dummy handler that does nothing
    };

Functions

EHandler::EHandler()
EHandler::~EHandler()
EHandler::DisplayException()
EHandler::Message()
EHandler::SignalException()
EHandler::Terminate()
EHandler::TrapException()

EHandler::EHandler()

- Default class constructor.

EHandler::~EHandler()

- Class destructor.

void EHandler::DisplayException(const char *mesg)

- Public member function used to display a error message in to form of a null terminated string. This function is indented to display fatal program errors.

void EHandler::Message(const char *mesg1=" ", const char *mesg2=" ", const char *mesg3=" ")

- Public member function used to display a series of messages in to form of a null terminated string. This function is indented to display non-fatal errors, program and informational messages.

void EHandler::SignalException(const char *mesg, int Level = EHandler::DISPLAY)

- Public member function used to signal an exception by displaying an error message or by displaying an error message and terminating the program.

void EHandler::Terminate()

- Public member function used terminate the program. The routine used to terminate the program is dependent on the API used.

void EHandler::TrapException(AF ActionFunction)

- Public member function used to handle a user defined routine to trap a program exception. ActionFunction is a function pointer to a function defined within the application:

    typedef void (*AF)(); // Function pointer for action function

End Of Document