Anonymous user
Exceptions/Catch an exception thrown in a nested call: Difference between revisions
Exceptions/Catch an exception thrown in a nested call (view source)
Revision as of 11:50, 9 July 2014
, 10 years agoAdd Nimrod
(Add Nimrod) |
|||
Line 1,554:
at NestedExceptions.NestedExceptions.Foo()
at NestedExceptions.NestedExceptions.Main()</pre>
=={{header|Nimrod}}==
<lang nimrod>type U0 = object of EBase
type U1 = object of EBase
proc baz(i) =
if i > 0: raise newException(U1, "Some error")
else: raise newException(U0, "Another error")
proc bar(i) =
baz(i)
proc foo() =
for i in 0..1:
try:
bar(i)
except U0:
echo "Function foo caught exception U0"
foo()</lang>
=={{header|Objective-C}}==
|