ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Catch sequence error in LabVIEW

Solved!
Go to solution

Hi,

I execute Teststand sequences from my LabVIEW application. 

When an error occures in my sequence, I have the runtime error popup displayed asking to break, abort, terminate, etc...

LoisLbsUromems_1-1732890755654.png

I would like to catch this event and the associated error to log it with my LabVIEW application but I cannot find the callback associated with this event. 

I thought it would be the "ReportError" callback from Application Manager but it seems this one is not generated in this case?

LoisLbsUromems_0-1732890667333.png

I have also find the "DisplayCustomRuntimeError" callback which is called :

LoisLbsUromems_0-1732892592639.png

But I don't know to extract the associated error because it is not in the input parameters of this callback : 

LoisLbsUromems_1-1732892624276.png

 

Thank you for your help. 

 

0 Kudos
Message 1 of 6
(1,237 Views)

I've never tried this myself so.... and I can't really read the screenshots attached due to their size / resolution...

 

The UI exmaples which ship with TestStand use the report error callback, so you might want to check, how it works for them. Maybe you can find a difference.

 

There is also a UiMessage being sent when an error occurs

 

UIMsg_RuntimeError
    –(Value: 45) TestStand posts this message to the user interface to notify the user interface that the execution has encountered a run-time error. The user interface can alter the error, for example, by adding contextual information to the error message.

 

If it's only for logging purpose, this might also help.

0 Kudos
Message 2 of 6
(1,222 Views)

Thank you for your quick answer. On my side, when I click on the screenshots, it maximizes the image and it is in high resolution.

 

I tried to use the simple example UI of Teststand and when I run my sequence with error, the ReportError callback is not generated either.

 

I tried the UIMsg callback and indeed I can detect the runtime error but I don't know how to extract the error info from there?

 

LoisLbsUromems_0-1732896363522.png

 

0 Kudos
Message 3 of 6
(1,209 Views)

The callback is given a SequenceContext (ctxt) parameter, and you should be able to use that to find the error information. Look at: RunState.Step.Result.Error.Msg

Scott_Richardson_1-1732994722948.png

 

So you should be able to use the following pseudo code: 

    ctxt.AsPropertyObject().GetPropertyObject("RunState.Step.Result.Error.Msg",0);

 

Scott Richardson
https://testeract.com
Message 4 of 6
(1,193 Views)
Solution
Accepted by LoisLbsUromems

Ok, I didn't find exactly how to do like you said but it inspired me to find a solution !

This is how I solved it : 

LoisLbsUromems_0-1733133600387.png

 

Message 5 of 6
(1,181 Views)

Nice, I had totally forgotten about the SequenceContext.GetRunTimeErrorMessageEx(). Thanks for posting your solution.

Scott Richardson
https://testeract.com
0 Kudos
Message 6 of 6
(1,143 Views)