Skip to main content

11 Exceptions

danger

This Reference Manual output has not been verified, and may contain omissions or errors. Report any problems on the tracking issue

1/3

[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. ]

1.a

To be honest: ...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/5

To be honest: When the meaning is clear from the context, we sometimes use “occurrence” as a shorthand for “exception occurrence”.

1.d/5

Term entry: exception — kind of exceptional situation

1.e/5

Term entry: exception occurrence — run-time occurrence of an exceptional situation

2/3

[An exception_declaration declares a name for an exception. An exception can be raised explicitly (for example, by a raise_statement) or implicitly (for example, 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.

Wording Changes from Ada 2005

2.b/3
correction

Generalized the introductory description of how an exception can be raised so that it does not appear to cover all of the cases.