summaryrefslogtreecommitdiff
path: root/exception_test3/exceptiontest3.adb
blob: be4bd1bb734be521f5a83a59cba1744ef9b784d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--BEGIN exceptiontest3.adb
with Ada.Text_IO; use Ada.Text_IO;

procedure ExceptionTest3 is
   function F return Boolean is
   begin
      raise Constraint_Error;
      return True;
   end F;
begin
   begin
      if F then
         Put_Line ("Not ok");
      else
         Put_Line ("Not ok and bad value");
      end if;
   exception
      when Constraint_Error =>
         Put_Line ("Caught Constraint_Error -- inner");
      when others =>
         Put_Line ("not ok wrong exception");
   end;
exception
   when others =>
     Put_Line ("Caught Constraint_Error -- outer -- not OK");
end ExceptionTest3;
--END exceptiontest3.adb