Same idea. If you have an error
you must disarm it before looking at it.
Let's go back to the tried and true method
which I use all the time:

        either error? set/any 'err try [...][
                ; An error happened
                err: disarm err
                probe err
        ][
                ; No error
                ; err is set to the result of doing the
                ; code block, though, so
                ; err might have a value or unset!
        ]

Anton.

> Hi Andrew,
> 
> Yes ... but that isnt using the suggested method of set/any 
> 'error try [......]
> 
> for eample
> 
> >> set/any 'error try [print " "]
> 
> >> disarm error
> ** Script Error: error has no value
> ** Near: disarm error
> 
> 
> Cheers Phil
> 
> === Original Message ===
> 
> 
> Phil wrote:
> > How do you test for an error?
> > 
> > any time I try to do anything with error I get an error :-)
> 
> >> disarm error: try [1 / 0]
> >> probe error
> ** Math Error: Attempt to divide by zero
> ** Near: 1 / 0
> >> probe disarm error
> 
> make object! [
>     code: 400
>     type: 'math
>     id: 'zero-divide
>     arg1: none
>     arg2: none
>     arg3: none
>     near: [1 / 0]
>     where: none
> ]
> >>
> 
> Andrew J Martin

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

Reply via email to