Re: how to clear error message [message #73269 is a reply to message #73266] |
Wed, 03 November 2010 19:29   |
Truong Le
Messages: 42 Registered: September 2010
|
Member |
|
|
On Nov 3, 10:24 pm, Truong Le <truong...@gmail.com> wrote:
> On Nov 3, 9:44 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> Truong Le writes:
>>> David, I am not trying to suppress the error but instead I am
>>> trying to catch that error so that I can exit my loop and read the
>>> next FITS file.
>
>> Yes, and several people have suggested a CATCH error
>> handler, which to almost everyone responding here
>> would seem to be *exactly* what you want to use.
>> So, what is the problem?
>
>> Is the problem that the "message" is an informational
>> message and not really an error?
>
>> We really need more details I guess, if we are going
>> to help in any sensible way. It doesn't help us to know
>> something "didn't work." That's almost always an excuse
>> for pilot error. :-)
>
>> Cheers,
>
>> David
>
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> okay, let's say I have 100 FITS files that I want to loop through to
> check certain
> keywords from each FITS file. To obtain the header keywords I use the
> headfits.pro
> from the Astronomy IDL's library. When one of the FITS file is badly
> formatted headfit
> spat out a run-on warning message "% MRD_HREAD: Warning-Invalid
> characters in header" and
> then eventually die. I want to be able to catch this error and move on
> reading the next
> FITS file. The problem that I am having is that I use the "Catch"
> error handler to catch
> this error as people have suggested but it doesn't work. I have read
> some of your other
> thread that talk about trapping error by using
>
> files = ['file1.fits', 'file2.fits', 'file3.fits', ....]
> for i=0,100 do begin
> header = headfit(files[i])
>
> Help, /Last_Message, Output=theErrorMessage
> errorLength = N_ELEMENTS(theErrorMessage)
>
> if (errorLength GT 0) then begin
> goto, jumptoendOFloop
> endif
> ....
> ....
> ....
> jumptoendOfloop
> endfor
>
> This will trap the error of the bad FITS file, however, I need to know
> how I can clear
> the "errors" that are in memory so that in my next loop with a good
> FITS file I will pass
> through the above example.
>
> and thank you for all the help guys!
incomplete thought :-) ...
I have read some of your other thread that talk about trapping error
by using
> Help, /Last_Message, Output=theErrorMessage
> errorLength = N_ELEMENTS(theErrorMessage)
I need to know how to clear the "errors" that are in memory once you
have trap the
error using the above method?
|
|
|