[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Catching type conversion errors



Stein Vidar Hagfors Haugan wrote:
> 
> Martin Schultz <mgs@io.harvard.edu> wrote:
> 
> >This definitively runs counter what they say in the online help, and
> >should therefore considered a real bug.
> 
> Hmm. My online help (v 5.2) states that
> 
>    Calling CATCH establishes an error handler for the current
>    procedure that intercepts all errors that can be handled
>    by IDL, excluding non-fatal warnings such as math errors.
> 
> The key phrase here is *non-fatal* warnings. Type conversion
> "errors" don't halt the program flow (they never have), and
> are thus not "fatal".
> 
> In my view, that makes it a real (even documented) feature :-)
> 
> Regards,
> 
> Stein Vidar


Not quite, I think. If type conversion errors were in fact subsumed
under math errors, that would be OK, because then you could catch fatal
errors and treat all others with the math error routines. But as it
stands now, you have to handle io errors with on_ioerror in order to get
control over type onversion, which forces you to explicitely handle all
other io errors as well (because on_ioerror superseeds catch).  This
runs counter the idea of catch I would think. In my oppinion, a good way
out would be some /NON_FATAL keyword to catch which would catch those
errors as well, and a FATAL tag in the !ERROR_STATE structure so that
the user can identify the severeness of the error within the catch
block.


It may not be a bug, but it's a nuisance anyhow.


Regards,
Martin.
-- 
-------------------------------------------------------------------
Dr. Martin Schultz                   
Department for Engineering&Applied Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA

phone: (617)-496-8318
fax  : (617)-495-4551

e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
-------------------------------------------------------------------