Error string?
[1/3] from: bga::bug-br::org::br at: 18-Mar-2004 17:00
Hello.
Having an error object, what would be the best way to retrieve the exact
error text tha would be returned by Rebol? I went as far as getting the
block it uses ("get error-block/id") but I could ot figure out a way to
convert this block to the final string Reol would display (i.e.
interpreting the ":argX" stuff).
Thanks.
-Bruno
[2/3] 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/
[3/3] 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:
<<quoted lines omitted: 43>>
> 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
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted