Exceptions/Catch an exception thrown in a nested call: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: changed/added comments and whitespace, changed indentations, changed some literals. |
m added whitespace and highlighting to the task's preamble. |
||
Line 6: | Line 6: | ||
{{omit from|Swift}} |
{{omit from|Swift}} |
||
Show how to create a user-defined exception and |
Show how to create a user-defined exception and show how to catch an exception raised from several nested calls away. |
||
show how to catch an exception raised from several nested calls away. |
|||
# Create two user-defined exceptions, U0 and U1. |
:# Create two user-defined exceptions, '''U0''' and '''U1'''. |
||
# Have function foo call function bar twice. |
:# Have function '''foo''' call function '''bar''' twice. |
||
# Have function bar call function baz. |
:# Have function '''bar''' call function '''baz'''. |
||
# Arrange for function baz to raise, or throw exception U0 on its first call, then exception U1 on its second. |
:# Arrange for function '''baz''' to raise, or throw exception '''U0''' on its first call, then exception '''U1''' on its second. |
||
# Function foo should catch only exception U0, not U1. |
:# Function '''foo''' should catch only exception '''U0''', not '''U1'''. |
||
<br> |
<br> |