[REBOL] Re:Trapping errors? - Not like the book says?
From: kgd03011:nifty:ne:jp at: 4-Aug-2000 0:17
Hi Doug,
Why don't you try it this way:
if error? error: try [send [doug--vos--eds--com] {test} true ][
log-event/error system/script/header/file "error" (disarm error)
]
SEND doesn't return a value, so TRY doesn't return one either. As a
result all the set-word error: sees is the unset! value, which produces
the error. If you add 'true to the end of the try block, that
ensures you'll have some value to set 'error to. Here's an illustration
with PRINT, another function that returns no value.
>> type? try [print "hello"]
hello
== unset!
>> error? try [print "hello"] ; ERROR? doesn't mind unset!
hello
== false
>> error? error: try [print "hello"] ; but error: can't stand it
hello
** Script Error: error needs a value.
** Where: error? error: try [print "hello"]
>> error? error: try [print "hello" true] ; give it TRUE to keep it happy
hello
== false
See you,
Eric