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

Home » Public Forums » archive » Re: programmatically detect problems in idl code
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: programmatically detect problems in idl code [message #45085 is a reply to message #45081] Mon, 01 August 2005 10:57 Go to previous messageGo to previous message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
If I understand what you're asking, you'd like an appropriate exit
status returned to the operating system such that you can check that
number and determine if you IDL code executed successfully. Is this
what you're after?

By default, IDL will always return an exit status of 0 regardless of
whether IDL was successful or not. You can set your own exit status
numbers with the exit command. For example,

exit, STATUS = 1

will immediately exit your program and the operating system will see a
value of 1 returned from the process. You can simply put a line like
this at the end of your main program. If all of your code was
successful, the OS will see the value 1. If there was an error anywhere
along the way, you'll see the value 0.

If you want to get fancier, you can use the on_error, on_ioerror, and
catch commands as mentioned in a previous message. These commands will
enable you to catch certain errors and then exit your program with a
custom status code for each error type. One word of warning however --
make sure you only put the exit codes in your main program and not in
any of your subroutines. Doing so can lead to code that is very
difficult to debug and can be very error prone. It's just good practice
to throw the error back out to the main level before exiting.

-Mike
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Installing IDL 6.1 on debian linux 2
Next Topic: Avoiding For Loops

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

Current Time: Fri Oct 10 09:14:28 PDT 2025

Total time taken to generate the page: 0.80051 seconds