Re: Error handling and tracebacks [message #40117 is a reply to message #40114] |
Wed, 21 July 2004 16:26  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Michael Wallace writes:
> How do I disable tracebacks associated with the message procedure?
My goodness, you are having a tough day, today. :-)
> Before the programming gurus yell at me for potentially hiding bugs my
> code, let me explain why I want to do this. I have a library of
> procedures and in certain cases I am creating my own errors via message
> which are several calls down in the stack. When the error comes out,
> there is a long traceback, but I only want the end user to see the
> message itself and not the entire traceback since the traceback is going
> several layers down into code that the end user shouldn't even be aware
> of. I do want the user to see the error, but not all the files and line
> numbers.
I think your only hope here is to CATCH the errors
thrown by MESSAGE yourself, then prune the error traceback
(which you maybe save in a string variable, with the OUTPUT
keyword) and pass it on to the user:
Catch, theError
IF theErron NE 0 THEN BEGIN
Help, /Traceback, Output=helpString
Prune, helpString
Print, helpString
ENDIF
I don't have any idea what the PRUNE procedure
might look like. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|