Ada 2012 Reference Manual
11.3 Raise Statements and Raise Expressions
A raise_statement raises an exception.
Syntax
If a raise_expression appears within the expression of one of the following contexts, the raise_expression shall appear within a pair of parentheses within the expression:
Legality Rules
The exception_name, if any, of a raise_statement or raise_expression shall denote an exception. A raise_statement with no exception_name (that is, a re-raise statement) shall be within a handler, but not within a body enclosed by that handler.
Name Resolution Rules
The string_expression or string_simple_expression, if any, of a raise_statement or raise_expression is expected to be of type String.
The expected type for a raise_expression shall be any single type.
Dynamic Semantics
To raise an exception is to raise a new occurrence of that exception, as explained in 11.4. For the execution of a raise_statement with an exception_name, the named exception is raised. Similarly, for the evaluation of a raise_expression, the named exception is raised. In both of these cases, if a string_expression or string_simple_expression is present, the expression is evaluated and its value is associated with the exception occurrence. For the execution of a re-raise statement, the exception occurrence that caused transfer of control to the innermost enclosing handler is raised again.
NOTES
1 If the evaluation of a string_expression or string_simple_expression raises an exception, that exception is propagated instead of the one denoted by the exception_name of the raise_statement or raise_expression.
Examples
Examples of raise statements:
raise; -- re-raise the current exception