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

Home » Public Forums » archive » combine CATCH and MESSAGE
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
combine CATCH and MESSAGE [message #77901] Tue, 27 September 2011 08:26
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Hello guys,

I used to use the CATCH method to catch the errors on my code but I
also like the method using ON_ERROR,2 and MESSAGE.
Right now, I would like to combine these 2 methods. Something like:

PRO TEST, arg_1, ERROR=error

CATCH, error_status
IF error_status EQ 0 THEN BEGIN
error=0
IF N_ELEMENTS(arg_1) EQ 0 THEN MESSAGE, 'Incorrect number of
arguments'

ENDIF ELSE BEGIN
error=1
CATCH, /CANCEL
ENDELSE

END

Note that in this routine, the output keyword error is very important.
The problem here is that I want the message to cause the error and
that is not happening. Do you know if there is a way to do that ? I
mean without doing :

IF N_ELEMENTS(arg_1) EQ 0 THEN BEGIN
MESSAGE, Incorrect number of arguments', /INFORMATIONAL
error=1
RETURN
ENDIF

I also would like to ask for your opinion. I like the output keyword
error, is very useful on my programs but I also like the MESSAGEs,
they make the program very clear.

Thanks for your help,

nata
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: map_set issue
Next Topic: Re: combine CATCH and MESSAGE

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

Current Time: Fri Oct 10 11:33:05 PDT 2025

Total time taken to generate the page: 0.16106 seconds