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 16:37, 30 July 2015
, 8 years agoAdded EchoLisp
(→{{header|OCaml}}: general comment) |
(Added EchoLisp) |
||
Line 746:
<pre>Exception1 caught
User defined exception: Error message 2</pre>
=={{header|EchoLisp}}==
<lang lisp>
(define (foo)
(for ((i 2))
(try
(bar i)
(catch (id message)
(if (= id 'U0)
(writeln message 'catched)
(error id "not catched"))))))
(define (bar i)
(baz i))
(define (baz i)
(if (= i 0)
(throw 'U0 "U0 raised")
(throw 'U1 "U1 raised")))
(foo) →
"U0 raised" catched
👓 error: U1 not catched
</lang>
=={{header|Eiffel}}==
|