Re: Catching type conversion errors [message #13912] |
Thu, 31 December 1998 00:00 |
steinhh
Messages: 260 Registered: June 1994
|
Senior Member |
|
|
Re-reading my previous post on this subject, I must add that I
do agree with Martin Schultz and M. Hegde that the behaviour is
a nuisance!
Regards,
Stein Vidar
|
|
|
Re: Catching type conversion errors [message #13917 is a reply to message #13912] |
Wed, 30 December 1998 00:00  |
hegde
Messages: 17 Registered: December 1995
|
Junior Member |
|
|
Stein Vidar Hagfors Haugan (steinhh@ulrik.uio.no) 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 :-)
I think math errors are different in the sense that they are system dependent.
Type conversion ( I/O ) errors are IDL supported and seen by ON_IOERROR.
The control flow chart indicates CATCH should see everything that ON_IOERROR sees.
To circumvent this inability of CATCH, one has to use ON_IOERROR in addition
to CATCH; using two blocks of error handlers doesn't sound good to me.
Adding to this misery, FIX('') doesn't generate an exception/warning at all!
BTW, how to turn off these error messages? I tried !QUIET; it doesn't work
on SGI IRIX or SUN OS.
Regards,
-M. Hegde
|
|
|
Re: Catching type conversion errors [message #13921 is a reply to message #13917] |
Wed, 30 December 1998 00:00  |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
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/
------------------------------------------------------------ -------
|
|
|
Re: Catching type conversion errors [message #13927 is a reply to message #13917] |
Tue, 29 December 1998 00:00  |
steinhh
Messages: 260 Registered: June 1994
|
Senior Member |
|
|
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
|
|
|
Re: Catching type conversion errors [message #13928 is a reply to message #13927] |
Tue, 29 December 1998 00:00  |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
M. Hegde wrote:
>
> Hi,
>
> I observe that CATCH doesn't capture type conversion errors ( in the absence
> of ON_IOERROR command ). This appears to violate the error handling mechanism
> given in the IDL user's guide. Am I missing something? Are there any other
> errors which CATCH can not capture?
>
> Thanks in advance.
>
> -M. Hegde
>
> ex:
> PRO test
> CATCH, err
> IF ( err NE 0 ) THEN BEGIN
> PRINT, !ERROR
> RETURN
> ENDIF
> a = FIX ( 'abc' )
>
> END
same behaviour ...
{ mipseb IRIX unix 5.1.1 Jul 20 1998}
This definitively runs counter what they say in the online help, and
should therefore considered a real bug.
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/
------------------------------------------------------------ -------
|
|
|