comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Passing optional parameters through a wrapper routine
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Passing optional parameters through a wrapper routine [message #18901 is a reply to message #18840] Fri, 11 February 2000 00:00 Go to previous messageGo to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
edward.s.meinel@aero.org wrote:
>
>
> Ugh, I *hate* MESSAGE. Why cause a crash when it is easy to exit nicely?
> How about:
>
> IF N_ELEMENTS(arg1) EQ 0 THEN BEGIN
> print, 'You haven't defined arg1'
> RETURN
> ENDIF

You can still use MESSAGE to print out your warning. Just use the
/CONTINUE
keyword. What I like about message is that it tells you the routine
you're in.

>> if in doubt, stop and call for help.
>
> Right, but you can stop and ask for help without forcing a crash. How
> about:
>
> IF SIZE(arg2, /TNAME) NE 'STRING' THEN BEGIN
>
> ; Oooops! forgot the file name.
>
> arg2 = DIALOG_PICKFILE(set_the_appropriate_keywords)
> IF arg2 EQ '' THEN BEGIN
> dummy = DIALOG_MESSAGE( $
> 'You must provide a file name as the second argument')
> RETURN
> ENDIF
> ENDIF

Oh, I think one could write whole books on error treatment (just that no
one would
read them, I fear ;-). I try to group errors into categories like:

FATAL AND FUNDAMENTAL: stop right here and there and tell the user to
ring me up in the middle of the night or at least send me mail

FATAL USER ERROR: tell the user what an idiot he/she is and quit
execution gracefully
(message,...,/Continue & return)

SERIOUS ERROR: When in interactive mode, stop gracefully and complain;
when in batch mode, log the error into a file and continue.

MILD ERROR: Complain and try to take corrective actions - in interactive
mode let the user decide how to continue (e.g. by showing the pickfile
dialog)

WARNING: Complain and continue

And maybe one should add
DEBUG INFO: produce verbose output when debugging


Well, that's my philosophy - but I must admit, it's not always easy to
discipline myself to actually implement it...

Cheers,
Martin


--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Superscripts in IDL [x-y]title
Next Topic: superscripts

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 21:59:33 PDT 2025

Total time taken to generate the page: 0.63884 seconds