Exceptions/Catch an exception thrown in a nested call: Difference between revisions
Content added Content deleted
(Added Quackery.) |
|||
Line 857: | Line 857: | ||
bazCallCount += 1 |
bazCallCount += 1 |
||
if bazCallCount == 1 { |
if bazCallCount == 1 { |
||
throw |
throw Error.BazCall1() |
||
} else if bazCallCount == 2 { |
} else if bazCallCount == 2 { |
||
throw |
throw Error.BazCall2() |
||
} |
} |
||
} |
} |
||
Line 873: | Line 873: | ||
bar() |
bar() |
||
} catch { |
} catch { |
||
BazCall1() => print("BazzCall1 caught.") |
|||
} |
} |
||
calls -= 1 |
calls -= 1 |
||
} |
} |
||
} |
} |
||
foo()</lang> |
foo()</lang> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre>BazzCall1 caught. |
||
Runtime exception Dy601: |
Unhandled exception. Runtime exception Dy601: BazCall2 |
||
Stack trace: ...</pre> |
Stack trace: ...</pre> |
||