[REBOL] Re: Please help me to promote REBOL
From: SunandaDH:aol at: 10-Nov-2003 12:41
Anton:
> Wow, that's a cool feedback waiting to happen.
> :)
I've tried it, and it seems to have been fixed in the more recent betas. But
it still ends up with 'error being unset:
set/any 'error try [unset 'set]
if error? error [print "whoops!"]
** Script Error: error has no value
Amending my original suggestion to take into account TRY'd code unsetting
'true or 'set, I'd suggest this for a simple, foolproof way to catch an error:
don't use 'true, use 1:
if error? error-code: try [do %config.r 1]
[probe disarm error-code]
if error? error-code: try [print "" 1]
[probe disarm error-code]
It's harder to unset 1.
But the DO'd code could still have messed with 'if or 'error? or 'probe.
That raises a wider question about DOing untrusted code.
If you don't trust it at all, maybe it's better not to DO it in the first
place.
To seriously stop it messing things up while debugging:
protect-system
unset 'unprotect
if error? error-code: try [do %config.r 1]
[probe disarm error-code]
Sunanda.