Re: Questions about using CATCH [message #34045] |
Wed, 12 February 2003 23:47 |
Jonathan Greenberg
Messages: 91 Registered: November 2002
|
Member |
|
|
Thanks! catch,/cancel was the key -- I was not using it really to debug,
rather, I needed to control some of the IDL routines that don't have
explicit error handling (like file_copy --> the program had one routine if
it failed, not just quitting out).
--j
On 2/12/03 9:36 PM, in article MPG.18b4dcb67e4bd143989ae0@news.frii.com,
"David Fanning" <david@dfanning.com> wrote:
> Jonathan Greenberg (greenberg@ucdavis.edu) writes:
>
>> Couple of questions about "catch":
>>
>> 1) If I have two catch calls in the save program, will the program return to
>> the most recent catch statement (and error handling procedure)?
>
> Yes, only one CATCH can be current in a program module
> at any one time, but you can put as many as you like, to
> catch as many errors as you like, in your program module.
> When an error occurs, you will be directed to the first
> line of code after the CATCH that is currently registered
> for that program module.
>
>> 2) Can I supress the output of a "caught" error (e.g. I assume that my error
>> handler worked, so I don't want to see the error each time)?
>
> You can do whatever you like. :-)
>
> I don't recommend, however, handling errors silently.
> Debugging programs that handle errors silently can
> be similar to a bad drug experience. After a couple of
> days of it, you are completely psychotic. :-(
>
> Cheers,
>
> David
|
|
|
Re: Questions about using CATCH [message #34046 is a reply to message #34045] |
Wed, 12 February 2003 21:36  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Jonathan Greenberg (greenberg@ucdavis.edu) writes:
> Couple of questions about "catch":
>
> 1) If I have two catch calls in the save program, will the program return to
> the most recent catch statement (and error handling procedure)?
Yes, only one CATCH can be current in a program module
at any one time, but you can put as many as you like, to
catch as many errors as you like, in your program module.
When an error occurs, you will be directed to the first
line of code after the CATCH that is currently registered
for that program module.
> 2) Can I supress the output of a "caught" error (e.g. I assume that my error
> handler worked, so I don't want to see the error each time)?
You can do whatever you like. :-)
I don't recommend, however, handling errors silently.
Debugging programs that handle errors silently can
be similar to a bad drug experience. After a couple of
days of it, you are completely psychotic. :-(
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|