4.3.2 Catch an Exception

Programmers can use exception processing to handle cases that interrupt the main flow of control. The advantage of exception processing is that special cases for exceptions do not need to be explicitly coded in the main program flow. This greatly simplifies programs as exception processing can account for much of the code in a program.

Several different types of exception handlers can be coded after a primary method. The handlers share access to any variables that the primary method can access. They may also have their own local variables. Specialized handlers can selectively field specific assertions, method calls, or signalled variables.


Each handler method ends with a Return command and an optional switch or variable to determine if the method should simply return or propagate the exception up the call chain. The Raise switch always propagates the exception. A variable set to a non-zero value will also propagete the exception. Otherwise the handler will return normally from the primary method.


Idiom Procedure

Working With Exceptions