Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
1
Task/Exceptions/Ada/exceptions-1.ada
Normal file
1
Task/Exceptions/Ada/exceptions-1.ada
Normal file
|
|
@ -0,0 +1 @@
|
|||
Foo_Error : exception;
|
||||
4
Task/Exceptions/Ada/exceptions-2.ada
Normal file
4
Task/Exceptions/Ada/exceptions-2.ada
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
procedure Foo is
|
||||
begin
|
||||
raise Foo_Error;
|
||||
end Foo;
|
||||
6
Task/Exceptions/Ada/exceptions-3.ada
Normal file
6
Task/Exceptions/Ada/exceptions-3.ada
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
...
|
||||
exception
|
||||
when Foo_Error =>
|
||||
if ... then -- Alas, cannot handle it here,
|
||||
raise; -- continue propagation of
|
||||
end if;
|
||||
9
Task/Exceptions/Ada/exceptions-4.ada
Normal file
9
Task/Exceptions/Ada/exceptions-4.ada
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
procedure Call_Foo is
|
||||
begin
|
||||
Foo;
|
||||
exception
|
||||
when Foo_Error =>
|
||||
... -- do something
|
||||
when others =>
|
||||
... -- this catches all other exceptions
|
||||
end Call_Foo;
|
||||
12
Task/Exceptions/Ada/exceptions-5.ada
Normal file
12
Task/Exceptions/Ada/exceptions-5.ada
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
with Ada.Exceptions; use Ada.Exceptions;
|
||||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Main is
|
||||
begin
|
||||
...
|
||||
Raise_Exception (Foo_Error'Identity, "This is the exception message");
|
||||
..
|
||||
exception
|
||||
when Error : others =>
|
||||
Put_Line ("Something is wrong here" & Exception_Information (Error));
|
||||
end Main;
|
||||
Loading…
Add table
Add a link
Reference in a new issue