Exceptions: Difference between revisions

extended task to include trowing an exception
(extended task to include trowing an exception)
Line 1:
{{task}}
 
This task is to give an example of an exception handling routine and to "throw" a new exception.
 
==[[AppleScript]]==
[[Category:AppleScript]]
===try===
try
set num to 1 / 0
Line 10 ⟶ 11:
end try
 
===try-on error===
try
set num to 1 / 0
Line 17 ⟶ 19:
display alert "Error # " & errNum & return & errMess
end try
 
===throw===
error "Error message." number 2000
 
==[[C plus plus|C++]]==
Anonymous user