Ada Resource Association
News and resources for the Ada programming language
Annotated Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

11   Exceptions

{AI05-0299-1} [This clause section 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.” 
{AI05-0043-1} {AI05-0258-1} [An exception_declaration declares a name for an exception. An exception can be is raised explicitly (for example, initially either 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

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. 

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe