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

Re: !ERR and MPFIT



I apologize if I am missing a problem with error handling that Craig is
solving. I just want to ask why can't you use CATCH to handle errors
conditions? It seems to me that CATCH combined with MESSAGE procedure works
quite well for user-defined errors, and CATCH by itself works great for
internal IDL routines. This also eliminates the need for separate error
handlers.

Cheers,
Pavel

Craig Markwardt wrote:

> Unfortunately I chose to use the !ERR system variable.  If !ERR is set
> to a negative number, then MPFIT aborts the run, assuming that there
> was an unrecoverable error.
>
> I now realize that using !ERR was probably a mistake.  Why?  RSI seems
> to want to make it obsolete.  Through their error-handling flavor of
> the month program, !ERR seems to have fallen out of favor.  Also,
> there are quite a few actions which might set !ERR accidentally in the
> user's function without actually signalling an error condition.
>
> So I have two questions:
>
>  * to people who use MPFIT: does anybody actually use the !ERR status
>    variable to control the fitting process?  If not, then I would
>    consider removing it.
>
>  * to everybody: any suggestions on how to generically signal an error
>    condition?  My thoughts were:
>
>      - ERROR keyword variable - don't like this, since then the
>        function has to accept keywords
>
>      - define a new system variable - don't like this either, since
>        it's hard to do system variables right
>
>      - common block variable - not very pretty, but gets the job done.
>
> To be clear, this is some kind of error flag that a user routine would
> (optionally!) set to signal an abnormal termination condition.  Right
> now I am leaning toward the common-block approach.  Sorry David.
>
> Thanks,
>
> Craig