[REBOL] Re: Error string?
From: bga:bug-br at: 18-Mar-2004 18:35
Thanks!
-Bruno
On Thu, 18 Mar 2004 21:28:12 +0100, Gabriele Santilli <
[g--santilli--tiscalinet--it]> said:
> Hi Bruno,
>
> On Thursday, March 18, 2004, 9:00:10 PM, you wrote:
>
> BGA> Having an error object, what would be the best way to retrieve
> the exact
> BGA> error text tha would be returned by Rebol? I went as far as
> getting the
>
> #do [document {
> FORM-ERROR takes a disarmed error object and creates an error
> message. With the /ALL refinement, the result is the same as would
> be produced by the REBOL console.
> }]
>
> form-error:
> func [
> "Forms an error message"
> errobj [object!] "Disarmed error"
> /all "Use the same format as the REBOL console"
>
> /local errtype text
> ] [
> errtype: get in system/error errobj/type
> text: get in errtype errobj/id
> if block? text [text: reform bind/copy text in errobj 'self]
> either all [
> rejoin [
> "** " errtype/type ": " text newline
> either errobj/where [join "** Where: " [errobj/where
> newline]] [""]
> either errobj/near [join "** Near: " [mold/only
> errobj/near newline]] [""]
> ]
> ] [
> text
> ]
> ]
>
> >> print form-error disarm try [1 / 0]
> Attempt to divide by zero
> >> print form-error/all disarm try [1 / 0]
> ** Math Error: Attempt to divide by zero
> ** Near: 1 / 0
>
> >>
>
> Regards,
> Gabriele.
> --
> Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
> Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
>
> --
> To unsubscribe from this list, just send an email to
> [rebol-request--rebol--com] with unsubscribe as the subject.
--
Fortune Cookie Says:
A fanatic is one who can't change his mind and won't change the
subject.
-- Winston Churchill