11 Exceptions
{
AI05-0299-1}
[This clause defines the facilities for dealing with errors or other
exceptional situations that arise during program execution.]
An
exception represents a kind of exceptional situation; an occurrence
of such a situation (at run time) is called an
exception occurrence.
[
To
raise an exception is to abandon normal
program execution so as to draw attention to the fact that the corresponding
situation has arisen.
Performing some actions in
response to the arising of an exception is called
handling the
exception. ]
To be honest: ...or
handling the exception occurrence.
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.
To be honest: When
the meaning is clear from the context, we sometimes use “
occurrence”
as a short-hand for “exception occurrence.”
Wording Changes from Ada 83
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.
Wording Changes from Ada 2005
{
AI05-0043-1}
Correction: Generalized the introductory description of how an
exception can be raised so that it does not appear to cover all of the
cases.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe