LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

same error code for two different errors

I have a simple state machine with a few states, two of which are read ini file and read GPIB data. I also have an error handling state where I would like to handle all errors. Errors are checked for on each iteration of the loop, passed by shift register. However, I can't just unbundle the error cluster and wire the error code to a case structure because if the ini file doesn't exist (error code 7) I want to exit the program. But if I get error 7 from the gpib (Nonexistent GPIB interface) I want the program to continue running. What is the best way to track where the error is coming from so I know how to handle it when two error codes for different errors have the same error code value?
Message Edited by for(imstuck) on 01-27-2010 03:47 PM
0 Kudos
Message 1 of 6
(3,015 Views)

The Source field is intended to indicate the VI which generated the error.  When you find error 7, then check the Source string for the name of the VI which produced the error.  If it is a file or config VI, then it is a file error.  If it is a VISA or GPIB VI, it is a GPIB error.  You may have to see how many different VIs can generate these errors in your program and look for multiple possibilities.

 

Lynn

 

Message Edited by johnsold on 01-27-2010 05:08 PM
Message 2 of 6
(3,007 Views)
K, thats what I was going to do but I wasn't sure. I was hoping there was an easier way :/. Such is life.
0 Kudos
Message 3 of 6
(3,002 Views)

Another option is to check the existence of the file before opening the config file, then exit the program if nessecary. Relying on error codes might be a bad option.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 4 of 6
(2,986 Views)

TCPlomp wrote:

Another option is to check the existence of the file before opening the config file, then exit the program if nessecary. Relying on error codes might be a bad option.

 

Ton


So essentially handle the error right there and exit rather than wait for it to get to my error case?

 

0 Kudos
Message 5 of 6
(2,970 Views)
Yes, I think that's what was being implied.  Thanks.
Stephen Meserve
National Instruments
0 Kudos
Message 6 of 6
(2,942 Views)