Exceptions/Catch an exception thrown in a nested call: Difference between revisions

m
m (→‎{{header|Phix}}: added syntax colouring the hard way, phix/basics)
Line 852:
=={{header|Dyalect}}==
 
<lang dyalect>typevar U0()bazCallCount = 0
type U1()
var bazCallCount = 0
 
func baz() {
bazCallCount += 1
if bazCallCount == 1 {
throw U0()"Err0"
} else if bazCallCount == 2 {
throw U1()"Err1"
}
}
 
func bar() {
baz()
}
 
func foo() {
var calls = 2
Line 875 ⟶ 873:
bar()
} catch {
U0UnexpectedError("Err0") => print("U0Err0 caught.")
}
calls -= 1
}
}
}</lang>
 
}foo()</lang>
 
{{out}}
 
<pre>U0Err0 caught.
Runtime exception Dy601: U1Err1
Stack trace: ...</pre>
 
Anonymous user