B.3 Error Handling

The Input Deck database distinguishes between parse errors and runtime errors depending on the time when the error occurs. Parse errors occur during reading of input files or when single strings are parsed. Reading and parsing are performed by the reader module (see Section 3.5.2) of the Input Deck toolkit. Since the input files and input strings describe items of a database they have to be syntactically correct. Thus, the reader module immediately stops parsing when a parse error occurs. Nevertheless, the Input Deck reader is designed to be able to skip erroneous statements and to continue reading at the next statement. For this reason, the parser which is part of the reader module had to be designed very carefully to detect and to recover from erroneous statements. The consistency of the database is guaranteed at any time.

Erroneous statements cannot be corrected. The Input Deck reader can be configured to stop reading and parsing when the first parse error occurs. Therefore, items after the error are not read. However, items which have been successfully read before the error occurred remain in the database. An undo-procedure has not been implemented yet which may be useful to restore the previous state of the database if an error occurs during merging with another file.

When a runtime error occurs the current operation is stopped. The functions of the application always return a value which shows if the operation has been successful or not. Thus, for each time the application communicates with the Input Deck database it is informed about the state of the operation.

If an error has occurred the Input Deck database enters an error state. The number of the error can be obtained by a call to ipdGetErrorNumber.

ipdERR_Type_t ipdGetErrorNumber(void);

To get the corresponding error string the function ipdGetErrorMessage has to be called.

const char *ipdGetErrorMessage(void);

By a call to ipdResetError the error is cleared.

void ipdResetError(void);

Robert Klima 2003-02-06