5.16.1. Exceptions and Failure

There are many things that can go wrong when a program runs. The program might, for instance, try to read a file that does not exist. The program might try to find something in an array that is not present. It might divide by zero or use an array index that is not valid.

It is important for programs to be able to recover from such events. Users do not like software that suddenly stops. This chapter discusses a mechanism that facilitates recovery from situations where a desired step or computation cannot be done.