12.1 Exception handling

This technique is essential since it allows reuser to fix the exception situations. It enhances reusability and more discussions on this can be found in [Sommerville 87], and [Braun, Goodenough 85].

Guideline1 : Allow reuser to fix the exception situations by providing a generic procedure which raises corresponding exception as shown below.

generic

type Element is private;

with procedure Handle_Keyword_Not_Found is Keyword_Not_Found;

-----------

Guideline2 : Design an independent package specification to define all exceptions so that the exception names are made known to the reuser. See the following example of IO_Exception package defined in Ada.

Package IO_Exceptions is

Status_Error : Exception;

Mode__Error : Exception;

Name_Error : Exception;

-------------------

end IO_Exceptions;