Exceptions: Difference between revisions

no edit summary
No edit summary
Line 2:
 
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]]==
[[Category:AppleScript]]
Anonymous user