Re: Catch problem [message #23028 is a reply to message #23027] |
Tue, 02 January 2001 10:27  |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
Howdy,
I have done this all too frequently, Add ...
CATCH, /CANCEL
inside the if statement block so that the Error_Status value reverts to 0
(zero) before exiting the block. Error catching seems like big brother
watching to me... unlike the most of the procedures I know (maybe with the
exception of XMANAGER) where the action is history once the command is
given, CATCH keeps right on catching.
Ben
ALAN FRAZIER wrote:
> Recently, I started learning the catch procedure to help with some error
> checking. I typed the code word-for-word out of the IDL 5.3
> documentation:
>
> PRO ABC
>
> A = fltarr(10)
>
> CATCH, Error_status
>
> IF Error_status NE O THEN BEGIN
> PRINT, 'ERROR INDEX: ', Error_Status
> PRINT, 'ERROR MESSAGE: ', !ERR_STRING
> A = FLTARR(12)
> ENDIF
>
> A[11] = 12
>
> HELP, A
>
> END
>
> to help me learn this command. However, this code does not seem to
> execute correctly. As far as I can tell, the code causes some sort of
> infinite loop on the if statement. Any ideas what I am doing wrong? I am
> using IDL 5.4 on a Mac.
>
> --
> Alan
--
Ben Tupper
Bigelow Laboratory for Ocean Sciences
180 McKown Point Rd.
W. Boothbay Harbor, ME 04575
btupper@bigelow.org
|
|
|