[REBOL] Re: Better error messages?
From: nitsch-lists:netcologne at: 8-Dec-2001 5:52
RE: [REBOL] Re: Better error messages?
[SunandaDH--aol--com] wrote:
> Hi Gabrielle,
>
> Thanks for answering all those emails, including mine.
<<snip>>
> It tells me I'm in the middle of a switch statement, not the
> InitCode/DisplayScreen function. Could do better!
>
> > Also, you might just insert some probes around the places where
> > you use that code, so that you can easily spot the bug.
>
> When I'm developing code, i normally have a pretty good idea of which bit has
> gone belly-up, and the code is peppered with Prints and stuff at that stage.
>
> I am specifically looking for a better quality error message for when the
> code has been deployed in the field. There will be bugs, and I don't want to
> spend the first half hour in solving a bug report simply trying to work out
> which function has the problem.
>
interesting point.
thats more the job of logging then of error-messages?
i played a bit with it, and now there is a prototype
http://www.reboltech.com/library/scripts/error-logger.r
on the script-library.
your function would look like
displayscreen: func [[catch] p-type /local line-count] [
mission "displaying screen" [
switch p-type [
"A" [Line-Count: Line-Count + 1]
]
]
]
then and on error logs its mission-goal and the error to %error-log.txt .
of course you have to customize it ;-)
> The only workaround I have so far is Andrews. That I make sure each data name
> is unique to each function, so any line of code is traceable to that
> function. But I really, really do not want to be writing code like
>
> InitObject-DisplayScreen-Line-Count: InitObject-DisplayScreen-Line-Count + 1
>
> just to help me in debugging:
>
> ** Script Error: Cannot use add on none! value
> ** Where: switch
> ** Near: InitObject-DisplayScreen-Line-Count:
> InitObject-DisplayScreen-Line-Count + 1
>
> There surely must be a better way! Any ideas?
>
> Thanks,
> Sunanda.
-Volker