Contents   Index   Previous   Next


Section 11: Exceptions

1
   [This section defines the facilities for dealing with errors or other exceptional situations that arise during program execution.] {exception occurrence} {condition: See also exception} {signal (an exception): See raise} {throw (an exception): See raise} {catch (an exception): See handle} {Exception} [Glossary Entry]An exception represents a kind of exceptional situation; an occurrence of such a situation (at run time) is called an exception occurrence. [{raise (an exception) [partial]} To raise an exception is to abandon normal program execution so as to draw attention to the fact that the corresponding situation has arisen. {handle (an exception) [partial]} Performing some actions in response to the arising of an exception is called handling the exception. ]
1.a
To be honest: {handle (an exception occurrence) [partial]} ...or handling the exception occurrence.
1.b
Ramification: For example, an exception End_Error might represent error situations in which an attempt is made to read beyond end-of-file. During the execution of a partition, there might be numerous occurrences of this exception.
1.c
To be honest: {occurrence (of an exception)} When the meaning is clear from the context, we sometimes use ``occurrence'' as a short-hand for ``exception occurrence.''
2
   [An exception_declaration declares a name for an exception. An exception is raised initially either by a raise_statement or by the failure of a language-defined check. When an exception arises, control can be transferred to a user-provided exception_handler at the end of a handled_sequence_of_statements, or it can be propagated to a dynamically enclosing execution.]

Wording Changes from Ada 83

2.a
We are more explicit about the difference between an exception and an occurrence of an exception. This is necessary because we now have a type (Exception_Occurrence) that represents exception occurrences, so the program can manipulate them. Furthermore, we say that when an exception is propagated, it is the same occurrence that is being propagated (as opposed to a new occurrence of the same exception). The same issue applies to a re-raise statement. In order to understand these semantics, we have to make this distinction.

Contents   Index   Previous   Next   Legal