Oh ho, Ingo !
Thanks for pointing that out... Just what I want!
I remember seeing disarm in the dictionary, but I never tried it out until
now. :-)
Perhaps we could write a wrapper function that automatically wraps function
calls.
Incidentally, what does the special attribute 'catch, mentioned in help func,
do?
Anton.
[EMAIL PROTECTED] wrote:
> Hi Anton,
>
> it's not as if you can't do this, but you have to
> 'disarm the error before.
>
> a: func [][
> if error? err: try [
> ;
> ;code that may produce an error here...
> ;
> return "a nice result here"
> ][
> err: disarm err
> print reform ["error in function a" err/id]
> ]
> ]
>
> regards,
>
> Ingo
>
> Once upon a time [EMAIL PROTECTED] spoketh thus:
> > Hi,
> >
> > I disagree with your last statement (at bottom), Gabriele.
> > Recently, I wanted to assign 'err in a program like this (it doesn't
> > work):
> >
> > a: func [][
> > if error? err: try [
> > ;
> > ;code that may produce an error here...
> > ;
> > return "a nice result here"
> > ][print reform ["error in function a" err]]
> > ]
> >
> > Wouldn't that be nice?
> > A view program with code like that in all it's functions would keep
> > running when an error occurs,
> > but prints out the error message so the user can see what happened and
> > inform the programmer.
> > Or it could be stored in an error log for later viewing...
> >
> > Maybe we could have do/force or try/harder to continue executing code
> > after the try block when an error occurs, instead of bailing out to the
> > console. I can imagine a program that automatically emails the author
> > when errors occur. How about seeing a brief message like this:
> >
> > "Error in function blabla: 'doodle is unset. An error report has been
> > sent to the author."
> <...>
>
> --
> _ . _
> ingo@)|_ /| _| _ <We ARE all ONE www._|_o _ _ ._ _
> www./_|_) |o(_|(/_ We ARE all FREE> ingo@| |(_|o(_)| (_|
> ._| ._|