Table Of Contents

Error Handling in LabVIEW

Version:
    Last Modified: December 7, 2016

    When an error occurs in your code, LabVIEW suspends execution. If you don't want to suspend execution, you can handle errors programmatically.

    Automatic Error Handling

    If an error occurs while your code is running, the program suspends execution and displays a dialog box with information about the error.

    Programmatic Error Handling

    To collect or process error information while code runs instead of suspending its execution, use error clusters. You can wire error clusters to diagram objects as shown in the following table, but these wiring patterns are not exhaustive or required.

    Diagram Object Description Example
    Nodes Many nodes include error inputs and outputs to allow for programmatic error handling. Consider wiring these inputs and outputs to implement error handling in your code, especially for I/O operations, such as file I/O, serial, instrumentation, data acquisition, and communication.

    As the code runs, each node tests for errors at execution. If no errors occur, the node executes normally. If there are errors, the node that detects the error does not execute and passes the error information to the next node. The next node does the same thing, and so on. At the end of the execution flow, the last node returns error information to the error out indicator.

    Loops The conditional terminal of a loop can accept an error cluster. To stop the loop when an error occurs, wire an error cluster to the conditional terminal. You can also use Filter Error Code to stop the loop when a specific error occurs.
    Case Structures The selector terminal of a Case Structure can accept an error cluster. To execute different sets of code depending on whether an error exists, wire an error cluster to the selector terminal. The Case Structure automatically creates two cases, an error case and a no error case.

    Recently Viewed Topics