Chapter 14
Exceptions

Exceptions provide a convenient way to program error and error-recovery mechanisms, and are closely related to classes. Exception support is based on 3 constructs:

Raise 
statements. To raise an exeption. This is usually done to signal an error condition. It is however also usable to abort execution and immediatly return to a well-known point in the executable.
Try ... Except 
blocks. These block serve to catch exceptions raised within the scope of the block, and to provide exception-recovery code.
Try ... Finally 
blocks. These block serve to force code to be executed irrespective of an exception occurrence or not. They generally serve to clean up memory or close files in case an exception occurs. The compiler generates many implicit Try ... Finally blocks around procedure, to force memory consistency.
 14.1 The raise statement
 14.2 The try...except statement
 14.3 The try...finally statement
 14.4 Exception handling nesting
 14.5 Exception classes