Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Error string?

From: g:santilli:tiscalinet:it at: 18-Mar-2004 21:28

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/