function
FACTORIAL (N : POSITIVE) return
FLOAT is
begin
if
N = 1 then
return 1.0;
else
return
FLOAT(N) * FACTORIAL(N-1);
end if
;
exception
when
NUMERIC_ERROR => return
FLOAT'SAFE_LARGE;
end
FACTORIAL;
procedure
P is
ERROR : exception
;
procedure
R; procedure
Q is
begin
R;
... -- error situation (2)
exception
...
when
ERROR => -- handler E2
...
end
Q; procedure
R is
begin
... -- error situation (3)
end
R; begin
... -- error situation (1)
Q;
...
exception
...
when
ERROR => -- handler E1
...
end
P;
others
, situation (3) would cause execution of this handler, rather than direct termination of R.
others
.
procedure
P is
... begin
declare
N : INTEGER := F;
-- the function F may raise ERROR
begin
...
exception
when
ERROR => -- handler E1
end
;
... exception
when
ERROR => -- handler E2 end
P;
-- is handled by E2