NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle a LabVIEW error in TestStand cleanup code

Solved!
Go to solution

When a LabVIEW VI in TestStand's main sequence (Main) has an error, I would like to access this error cluster in the TestStand clean up sequence (Cleanup). It the error cluster information stored somewhere?

0 Kudos
Message 1 of 6
(5,034 Views)

Provided that the VI's error out cluster is on the connector pane (as most VI templates have), TestStand will automatically copy the values of the error cluster elements to the properties in Step.Result.Error.

0 Kudos
Message 2 of 6
(5,027 Views)

The problem is that the Cleanup section cannot see that Step.Result.Error.

 

In order to pass that Step.Result.Error information to the Cleanup section, I could copy it into a StationGlobals variable I create, but I would have to do that for every LabVIEW module in the Main section. I'm hoping that information is automatically available to the Cleanup section without me having to add code to every single LabVIEW module in the Main section.

 

Is that Step.Result.Error information available to the Cleanup section somewhere without me having to add code to the Main section?

0 Kudos
Message 3 of 6
(5,023 Views)
Solution
Accepted by topic author bmihura

HI,

 

It's also copied to runstate.sequence.error, unless you select ignore in the TestStand error dialog. I don't have a Windows machine here to check for the exact lookup string, but if you pause when you are in Cleanup, you can browse the Variables section, Runstate, and find the seqeunce error. BTW this is (part of) a common custom error handler technique. 

 

cc

Message 4 of 6
(5,016 Views)

YOu can access the result variables of any step.

Put a break point in the cleanup and looks for this from the variable pane : runstate.sequence.main.stepofinterest.variables

 

It is possible to access any previously run step results by the above method.

 

Message 5 of 6
(5,010 Views)

Ah, I did what you suggested and it is called RunState.SequenceError. I wired this into my clean-up VI in the CleanUp section, and it catches all LabVIEW errors from the Main section. Thanks!

Message 6 of 6
(5,003 Views)