comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » catch and I/O errors
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
catch and I/O errors [message #42891] Wed, 02 March 2005 13:58
Benjamin Hornberger is currently offline  Benjamin Hornberger
Messages: 258
Registered: March 2004
Senior Member
Hi all,

is there any way to handle I/O errors with catch? What's the distinction
between I/O errors and other errors good for anyway?

In the IDL online help to "Controlling Errors Using CATCH" (e.g., in the
Windows help file, find the reference to CATCH, click on the link
"Controlling Errors", then "Controlling Errors Using Catch"), there is a
flow chart about how errors are handled. It clearly sais that in case of
an I/O error, but with *no* use of the ON_IOERROR routine, error control
goes back to CATCH.

But look at the following example (BTW, why is a type conversion error
an I/O error? I think, that question has been asked before ...):

PRO test_error

catch, error
IF error NE 0 THEN BEGIN
catch, /cancel
print, 'Caught!'
return
ENDIF

a = 'string'
b = fix(a)

END

IDL> test_error
% Type conversion error: Unable to convert given STRING to Integer.
% Detected at: TEST_ERROR 14
D:\HOME\HORNBERG\SCRATCH\IDL_SCRATCH\test_error.pro

The error handler doesn't catch at all. If I leave it out, it's all the
same. This is not what the help article states. Am I missing something?

How would I write an error handler which would handle I/O errors and
other errors consistently in one routine?

Thanks for your help,

Benjamin
[Message index]
 
Read Message
Previous Topic: Re: Slow Around Here
Next Topic: Structures:

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:42:02 PDT 2025

Total time taken to generate the page: 0.00477 seconds