11.2 Exception Handlers
Syntax
exception_choice ::= exception_name | 
others 
Legality Rules
An 
exception_name 
of a choice shall not denote an exception declared in a generic formal 
package. 
 
Static Semantics
A 
choice_parameter_specification 
declares a 
choice parameter, which is a constant object of type 
Exception_Occurrence (see 
11.4.1). During 
the handling of an exception occurrence, the choice parameter, if any, 
of the handler represents the exception occurrence that is being handled.
 
Dynamic Semantics
Examples
Example of an exception 
handler: 
begin
   Open(File, In_File, "input.txt");   --
 see A.8.2
exception
   when E : Name_Error =>
      Put("Cannot open input file : ");
      Put_Line(Exception_Message(E));  --
 see 11.4.1
      raise;
end;
 
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe