Home > Support > NI Product Manuals > LabVIEW Communications System Design Suite 1.0 Manual
Version:

    Error Handling in LabVIEW

    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

    When LabVIEW suspends execution due to an error, it identifies the node that contains the error and displays error information in the Errors & Warnings pane.

    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, LabVIEW tests for errors at each node. If no errors occur, the node executes normally. If there are errors, LabVIEW does not execute that node 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, LabVIEW returns error information in 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 Error Properties to stop the loop for specific errors.
    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. LabVIEW automatically creates two cases, an error case and a no error case.

    To customize how your code responds to errors, you can use General Error Handler or Simple Error Handler. For example, you can create error exceptions, display dialog boxes, or define custom error descriptions.