Exceptions: Difference between revisions

Content added Content deleted
No edit summary
Line 2: Line 2:


This task is to give an example of an exception handling routine and to "throw" a new exception.
This task is to give an example of an exception handling routine and to "throw" a new exception.
==[[Ada]]==

[[Category:Ada]]
===Define an exception===
Foo_Error : Exception;
===Raise an exception===
procedure Foo is
begin
raise Foo_Error;
end Foo;
===Handle an exception===
procedure Call_Foo is
begin
Foo;
exception
when Foo_Error =>
-- do something
end Call_Foo;
==[[AppleScript]]==
==[[AppleScript]]==
[[Category:AppleScript]]
[[Category:AppleScript]]