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

Content added Content deleted
Line 1,847: Line 1,847:
val .bar = f(.i) .baz(.i)
val .bar = f(.i) .baz(.i)


val .foo = f(.i) {
val .foo = f() {
.bar(.i)
for .i in [0, 1] {
catch if .err["msg"] == .U0["msg"] {
.bar(.i)
writeln "caught .U0 in .foo()"
catch if .err["msg"] == .U0["msg"] {
writeln "caught .U0 in .foo()"
} else {
throw .err
} else {
throw
}
}
}
}
}


.foo(0)
.foo()</lang>
.foo(1)</lang>


{{out}}
{{out}}