Re: Catching errors with widgets [message #859 is a reply to message #857] |
Thu, 08 April 1993 06:37  |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
ian@gomez.jpl.nasa.gov (H. Ian Novack) writes:
> I a writing some widgets to do some simple things. One widget is for loading
> bands from a multi-spectral image on disk. This widget gets the parameters
> from the user and then calls another routine I wrote to extract the bands
> from the file.
> Fine.
> But, if the user overestimates the size of the image, then my extraction
> routine will hit end of file and die. The error will bubble up until I blast
> out of my widgets and get the IDL> prompt again.
I would rewrite your extraction routine to exit more gracefully, returning an
error code to the calling routine. You can return the error code in a keyword
to keep it compatible with the way it currently works.
> I read in the manuals that you can get back into the widgets with RETALL and
> XMANAGER, but I want this to happen automatically. I've fiddled with ON_ERROR,
> ON_IOERROR, RETURN and such, but can't get it to work.
> I *can* get it to not blast out, but then, when I try to load another image
> (of the right size), I get the following error message:
> % COLOR_QUAN: Variable is undefined: <UNDEFINED>.
> % Execution halted at ILOAD_EVENT </home/avdev/ian/idlpro/widget/id_load.pro(
> 188)> (COLOR_QUAN).
> % Called from XMANAGER </usr/local/idl/lib/widgets/xmanager.pro( 402)>.
> % Called from ID </home/avdev/ian/idlpro/widget/id.pro( 289)>.
> % Called from $MAIN$ .
> ILOAD_EVENT and ID are mine. The COLOR_QUAN is used to display the 24-bit
> data I'm reading in on the 8-bit display. Obviously, I can't tell which
> variable it's choking on.
Why not? Try putting HELP statements just before the call to COLOR_QUAN to
find out exactly what variables you're feeding it. I'd suggest putting a STOP
command just before COLOR_QUAN, but I understand that this may cause problems
with widgets in newer versions of IDL.
> Finally, I can't tailor my extraction routine too much, as it is a general
> utility that people use often.
That's one of the beauties of using keywords.
> Any ideas?
> |-Ian Novack (Particle Man)----------------------------ian@gomez.jpl.nasa.gov-|
> | "I am trying to fill a silent moment with Jet Propulsion Lab |
> | non-relevant conversation." -- Lt. Cmdr. Data Pasadena, CA |
> |-Disclaimer: Had this been an actual opinion, it would still be mine.--------|
Hope this is helpful,
Bill Thompson
|
|
|