Search code examples
exceptionerror-handlinglabview

Graceful failure in Labview (after failed opening of device - in this case camera)


I was wondering how to make it so the rest of the program runs when one component fails to (and therefor the rest of the path that relied on this component is incapacitated as well). In other languages, this is equivalent to "catching an exception," but the added issue here is that I'm afraid that even if such a feature existed (cant find if it does), then the rest of the program would still try to run... Any advice would be very much appreciated. Thanks in advance!


Solution

  • LabVIEW doesn't have exception handling, but handles error in a different way: (nearly) all VIs accept an error cluster as input (and so should yours); if it is positive (an error occurred), the VI will return immediately, passing error as output, and next will get it as input, etc. This is called error.

    As all these VIs transmit this cluster between each others you will get it in your top-level VI, so if error occurs you just have to cleanup stuff correctly it and exit.