[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


5.1 Overview of Exceptions

An exception is an object that describes an error condition. Operations on exception objects allow errors to be reported and handled. If an exception is handled properly, the program can recover from errors. For example, if an exception is raised from a parity error while reading a tape, the recovery action might be to retry 100 times before giving up.

Using a few simple macros, C functions can declare a block of code (an exception scope) where exceptions are to be caught, and can define a block of code within an exception scope to process a specific exception (or all exceptions). DECthreads exception handlers are attached, which means that the handler code appears within the block where exceptions are caught. This allows you to see what actions will be taken when an exception occurs.

There are two ways to process an exception that occurs within the exception scope: