Go to the previous, next chapter.

Error Handling --- Error.h

PROFIL contains a simple set of functions used for error handling. These set of functions is defined in the file Error.h. An error or a warning message is reported using the function Error which is defined as follows:

Function: void Error (char *ErrorMessage, INT ErrorCode, INT Severity)
The first parameter is the error message string which is printed out together with the error code given by the second parameter. The last parameter is a number which describes the severity level of the error.

The error severity level is divided into 4 classes where the class bounds are given by the values of the following variables:

Variable: INT ErrorHandler::WarningLevel
All error messages with a severity level less than this value will be ignored. Nothing will be printed out is this case.

The initial value of this variable is 1000.

Variable: INT ErrorHandler::SevereLevel
All error messages with a severity level less than this value but greater or equal than ErrorHandler::WarningLevel are printed as warning message and the program execution is continued.

If the severity level is greater or equal than ErrorHandler::ErrorLevel, it is considered as an error message which is printed out and the program execution is terminated.

The initial value of this variable is 2000.

A severity level of (-1) is considered as fatal error. The following subroutine is provided for simplicity:

Function: void FatalError (char *ErrorMessage)
This subroutine prints the error message given by ErrorMessage and terminates the program by producing a core image dump.

For the standard cases, the following variables are provided:

Variable: INT ErrorHandler::Ignore
If the initial values of the error class bounds are used, an message with this severity level will be ignored.

This variable contains the value 0.

Variable: INT ErrorHandler::Warning
If the initial values of the error class bounds are used, a message with this severity level will be issued as warning message.

This variable contains the initial value of ErrorHandler::WarningLevel.

Variable: INT ErrorHandler::SevereError
If the initial values of the error class bounds are used, a message with this severity level will be issued as error message.

This variable contains the initial value of ErrorHandler::SevereLevel.

Variable: INT ErrorHandler::Fatal
If the initial values of the error class bounds are used, a message with this severity level will be issued as fatal error message.

This variable contains the initial value of (-1).

The last used error code is also available:

Variable: INT ErrorHandler::LastErrorCode
Contains the last error code (i.e. the last used parameter ErrorCode of Error).

If not error leads to program termination, but warnings or ignored errors occured, an error report is generated either automatically at the end of the program or can be called anywhere using

Function: void ErrorReport ()
This subroutine prints some useful informtaion about the current error status.