LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error handling: how can an error cause code to be skipped?

Sorry for the simple question:
 
I have a VI with a series of sub vi's connected by an error bundle.  I realise that if an error occurs in, say the first VI that subsequent VI's don't do anything but  if subsequent VIs are in a sequence structure with other code inside it, why doesn't the other code get executed?
 
The VI I have has a timeout error on the first VI but when I run it an error pops with a VI well down the track saying an error occured there.  If I turn the highlight execution on I see that the thing was definitely stuck on the first VI.
0 Kudos
Message 1 of 6
(2,948 Views)
If you have automatic error handling enabled, the first VI that does not have the error output connected will trigger the error dialog.
 
Could you attach your code showing the "other" code that does not get executed. Does it depend in any way on outputs from one of the subVIs that is in the error path?
 
It is up to the programmer to determine what a subVI does when it gets an error on the input. Most often, they skip the code and send the input error to the output error terminal. Many other way to handle errors are possible.
0 Kudos
Message 2 of 6
(2,943 Views)
I have included the VI in question with comments in the block diagram
 
I have automatic error handling enabled but as far as I can tell all the error outputs are wired through.  If an error output wasn't wired through it should trigger the dialog on the first VI. 
 
Thanks
0 Kudos
Message 3 of 6
(2,939 Views)

The second subVI from the right "Stepper get current Position2.vi" has a second copy of itself overlayed on the wired version of same. Just click on the subVI and move it up or down to see. 😮

Since the extra copy is not wired to anything, it has no data dependency and will execute right away and in parallel to the rest of the code. Since no inputs are wired, it most likely generates an error. Since its error out is also not wired, it will generate the automatic error message.

Solution: delete the extra subVI. 🙂

0 Kudos
Message 4 of 6
(2,931 Views)
 A thousand apologies.
 
Waves of relief and embassment.
 
Thanks heaps.
 
I knew it was something like that but I looked the code again an again and I couldn't see anything wrong.
How did you know to look how to find that? 
 
 
0 Kudos
Message 5 of 6
(2,929 Views)


@pgaastra wrote:
How did you know to look how to find that? 

10+ years of LabVIEW programming. 🙂

I did not have any of your subVIs, so I wasn't able to even run the VI, however of you hover over that particular subVI with the mouse, you see all the connectors light up, something that only happens if the terminals are not connected.

I would recommend to make the "stepper handle" a required input for your subVIs. Without that connection, they won't do anything useful anyway and now you'll get an error if you forget to wire the input.

I don't have the VI analizer toolkit, but it probably would have found the problem too. See:
http://zone.ni.com/devzone/cda/tut/p/id/3588

 

0 Kudos
Message 6 of 6
(2,925 Views)