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

Home » Public Forums » archive » Hoping ON_IOERROR would catch errors in IDLs subroutines.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Hoping ON_IOERROR would catch errors in IDLs subroutines. [message #64939] Tue, 03 February 2009 15:17
M. Katz is currently offline  M. Katz
Messages: 69
Registered: May 2005
Member
I'm trying to understand why ON_IOERROR doesn't catch an error that
occurs with writing an image to the disk. Here's an example where I
attempt to write an image to an intentionally nonexistent folder (see
below).

When I run the program it breaks at WRITE_PNG instead of jumping down
to BAD_IO. However, if I change the WRITE_PNG to an OPENW, then it
catches the error and redirects the flow the BAD_IO.

What is the proper protocol to catch file errors in routines that IDL
provides, and handle them in the parent procedure?

-M. Katz

pro error_test1
ON_IOERROR, BAD_IO

nonexistent_folder = '/pink/elephant/'
WRITE_PNG, nonexistent_folder+'x.png', [[0b,1b],[1b,0b]]
PRINT, 'All is well.'
return

BAD_IO: begin
ON_IOERROR, NULL
PRINT, 'I caught the error!'
PRINT, !error_state.msg
end

return
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: |||X||| Not your Typical X-Rated Nudy Website
Next Topic: Re: Hoping ON_IOERROR would catch errors in IDLs subroutines.

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

Current Time: Fri Oct 10 06:04:09 PDT 2025

Total time taken to generate the page: 1.20087 seconds