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