PreviousNext

Catching a Particular Exception or All Exceptions

It is possible to discriminate among errors and perform different actions for each error.

Following is an example of catching a particular exception and specifying the recovery action (in this case, a message). The exception is reraised (passed to its callers) after catching the exception and executing the recovery action:

TRY {

read_tape ();

}

CATCH (parity_error) {

printf ("Oops, parity error, program terminating\n");

printf ("Try cleaning the heads!\n");

RERAISE;

}

ENDTRY