Yes, as Andreas shows, there problem is when the
try block returns an unset! value. eg:

>> if error? err: try [print "hi"][]
hi
** Script Error: err needs a value
** Near: if error? err: try [print "hi"]

Why did that happen?
try does the code block, and returns the last value, or
an armed error! object if there was an error.
But print doesn't return a value, so unset! is returned
(this is not an error).
err: is a set word and when it is done it expects a value.
unset! isn't good enough to be considered a value, so you
get the error message above.

The solution most of us have settled on is to use set/any, like this:

>> if error? set/any 'err try [print "hi"][print mold disarm err]
hi
== none

Using set/any allows the word 'err to also be set to an unset! as well
as all the usual values.

Anton.

> Thursday, January 8, 2004, 6:03:04 PM, M&F wrote:
> 
> > I have a question about the " Script Error: xxx has no value"
> > problem.
> 
> > I have seen that there's no way to trap such an error, which is not
> > a syntax one.
> 
> if error? try [ an-unset-value ] [ ... ]
> 
> -- 
> Best regards,
>  Andreas

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to