[REBOL] Re: Error handling
From: lmecir:mbox:vol:cz at: 3-Jul-2004 12:31
Gabriele Santilli napsal(a):
>Hi Ladislav,
>
>On Saturday, July 3, 2004, 8:10:19 AM, you wrote:
>
>LM> comment [; Usage/tests:
>
>LM> ex1: function [[catch]] [r] [
>LM> set/any 'r throw-on-error a
>LM> do b
>LM> ]
>
>LM> ex2: function [[catch]] [r] [
>LM> if none? set/any 'r attempt a [
>LM> throw make error! "error"
>LM> ]
>LM> do b
>LM> ]
>
>LM> ex3: function [[catch]] [r] [
>LM> set/any 'r default a 'error [throw error]
>LM> do b
>LM> ]
>
>LM> a: [return "OK"]
>LM> b: ["KO"]
>LM> ex1
>LM> ex2
>LM> ex3
>LM> a: [()]
>LM> b: [if not value? 'r ["OK"]]
>LM> ex1
>LM> ex2
>LM> ex3
>LM> a: [none]
>LM> b: ["OK"]
>LM> ex1
>LM> ex2
>LM> ex3
>LM> ]
>
>Hmm, I guess 'R should actually be global in the examples above?
>
>Regards,
> Gabriele.
>
No, it should be as it is to show what *does* and what *doesn't* work as
expected.
-L