LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why use manual error handling

Hi all, I am working on my first major LabVIEW project and I have a style-related question.  If I do not hook up all the error wires, when there is an error the failing subvi gets highlighted and I can fix the problem right away.  When I hook up all the error wires, if there is an error, it is hard to figure out which subvi failed.  I have to use highlight execution mode and watch the error signal until it hits the error, which can take a long time.  Debugging for me seems faster if I leave error wires unconnected, yet I have almost never seen  example code written this way.  Am I missing something?  Can someone explain why using error wires is so important?
0 Kudos
Message 1 of 4
(2,445 Views)

In most cases the source string of the error cluster is pointing you to the vi that threw the error.

 

If you chain the errors up, any properly designed SubVi will not execute their code except those that should do even if an error occures (Clear DAQmx task, Close File). This way you assure that the ressources are properly freed again. LV does a lot of this automatically for you. But consider you set an output to some 'high voltage', you want to get your program execute the code to set it back to a save level and not just stop on any (so undefined) place where the error occures.

 

Furthermore, not all errors are 'bad', but can be part of a normal operation (like the user might abort a file dialog or stopping a consumer loop by destroying the queue). 

 

Felix 

0 Kudos
Message 2 of 4
(2,434 Views)

j_osh_o wrote: 
Debugging for me seems faster if I leave error wires unconnected

It's true. That's why NI has this as a default option.

Allthough if you build an exe and distribute it, with manual handling is easier to find errors and important if you want your application to have a professional look. Also in many cases you don't need to show it to the user. You proccess it at the backround. 

0 Kudos
Message 3 of 4
(2,433 Views)
Thanks for your replies, this is good information for me.  I have been trying to use the error wires as much as possible because this was what I was taught, but now I have a better idea as to the reason.
0 Kudos
Message 4 of 4
(2,415 Views)