Error!
[1/3] from: ammonjohnson:ya:hoo at: 25-Oct-2001 21:15
Hi,
There has got to be away to change the default error handling rutine, what is? One of
you guys (or gals) surely knows what it is. I guess really what I am looking for is
the word to set, after all, there are NO RESERVED WORDS, right?
Thanks!!
Ammon
[2/3] from: tim:johnsons-web at: 25-Oct-2001 20:18
On Thu, Oct 25, 2001 at 09:15:15PM -0700, Ammon Johnson wrote:
> Hi,
>
> There has got to be away to change the default error handling rutine, what is?
One of you guys (or gals) surely knows what it is. I guess really what I am looking
for is the word to set, after all, there are NO RESERVED WORDS, right?
>
> Thanks!!
> Ammon
Hi Ammon: I'm not sure if I understand your question completely but:
Here's what I do.
1)A (slightly) customized error maker
2)An error handling routine
3)A try-catch style template
Error maker
==========
;##############################################################################################
; toss: Simple error-reporting function. Takes a block to aid message formatting
; ############################################################################################
toss: func[err-message[block!]][make error! rejoin err-message]
;
;Error Handling routine: this is included in the rebol.org script library
========================================================================
Author: "Bohdan Lechnowsky"
;############################################################################
; print-error: Bo's error trapper
; ###########################################################################
print-error: func[ error [object!]
/local arg1 arg2 arg3 message out ][
print "<pre>"
print rejoin ["======>ERROR:"]
out: make string! 100
set [arg1 arg2 arg3][error/arg1 error/arg2 error/arg3]
message: get in get in system/error error/type error/id
if block? message [bind message 'arg1]
append out reform reduce message
append out reform ["^/Near:" mold error/near]
append out reform ["^/Where:" mold error/where]
print out
]
;
;try-catch style temple
application: [; execution block
; code here
]
salvage:[print-error disarm err cgi/cls]
if error? set/any 'err try application salvage
HTH
>
> --
> To unsubscribe from this list, please send an email to
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.johnsons-web.com
[3/3] from: ammonjohnson::yahoo::com at: 26-Oct-2001 16:45
I have several error handling fucntions, but what I want is to actually
redefine the system error handler of REBOL. For example:
error-catch: function [] [] [;code that catches error]
;all the error producing code you want
;none of it is printed to console even though
;error-catch hasn't been called at all! (except
; by REBOL)
basically I want to decide what REBOL does with an error reguardless of
where it came from, or who produced it.
Thanks!!
Ammon
PS I guess I will keep browsing the system object till I find it. I know it
is their, Carl wouldn't have left it out.
Enjoy!!
Ammon
---- Original Message -----
From: "Tim Johnson" <[tim--johnsons-web--com]>
To: <[rebol-list--rebol--com]>
Sent: Thursday, October 25, 2001 9:18 PM
Subject: [REBOL] Re: Error!
> On Thu, Oct 25, 2001 at 09:15:15PM -0700, Ammon Johnson wrote:
> >
> > Hi,
> >
> > There has got to be away to change the default error handling
rutine, what is? One of you guys (or gals) surely knows what it is. I
guess really what I am looking for is the word to set, after all, there are
NO RESERVED WORDS, right?
> >
> > Thanks!!
<<quoted lines omitted: 6>>
> Error maker
> >
;###########################################################################
###################
> ; toss: Simple error-reporting function. Takes a block to aid message
formatting
> ;
############################################################################
################
> toss: func[err-message[block!]][make error! rejoin err-message]
> ;
> ;Error Handling routine: this is included in the rebol.org script library
> > Author: "Bohdan Lechnowsky"
>
;###########################################################################
#
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted