[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: trapping type conversion errors
William,
The error generated in your example is an IO error and can be trapped with
ON_IOERROR. It is a bit of a pain that CATCH will not catch this type of
error, but all is not lost.
PRO junk
; catch,error
; IF error NE 0 THEN BEGIN
; message,!error_state.msg,/info
; return
; ENDIF
ON_IOERROR, bad_data
t = ['01','aa']
tt = fix(t,type=2)
;print,"I'm here"
;message,!error_state.msg,/info
; help,!error_state,/st
Return
bad_data:
help,!error_state,/st
END
Regards,
George Constantinides
email: GeorgeC@mhl.nsw.gov.au
URL: http://www.mhl.nsw.gov.au