OSF DCE Application Development Guide--Core Components
Using the DCE Threads Exception-Returning Interface
If an exception is unhandled, the entire application process is terminated. Aborting the
process, rather than just the faulting thread, provides clean termination at the point of
error. This prevents the disappearance of the faulting thread from causing problems at
some later point.
An example of raising an exception is as follows:
RAISE (parity_error);
9.3.3 Defining a Region of Code over Which Exceptions Are Caught
Defining a region of code over which exceptions are caught allows you to call functions
that can raise an exception and specify the recovery action.
Following is an example of defining an exception-handling region (without indicating
any recovery actions):
TRY {
read_tape ();
}
ENDTRY;
9.3.4 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
124245 Tandem Computers Incorporated 9−5