NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Teststand error handling Option

Hello, I'm looking for a bit of advice on how to appropriately modify the SequenceFilePostStepRuntimeError Callback to get the behavior I'm looking for. There are two main questions I have:

 

1) The big thing that I'm looking to do is have a counter for how many times I've retried the error. Two of the errors that I'm seeing right now are fine on retry (eventually, it might take a time or two), so what I'd like to do is something like:

  1. Retry the error.
  2. If the error reoccurs, wait 1 second and retry again.
  3. If the error reoccurs, wait 5 seconds and retry again.
  4. If the error reoccurs, pop up the window for the user.

Obviously this only works if I know how many times the step has thrown the error, and I'm not aware of a way to do that. Maybe adding a parameter to the callback that it increments and the step just throws back? But I'm not sure I can do that.

 

2) How can I access the error text shown in the default pop-up window? Doing some analysis on the code will help me build my cases.

 

And a minor one, the NI example about this shows how to build a window that does the same things as the default pop-up, but isn't it. Is there any way to launch the default pop-up itself? I don't really see any way I can improve on it if I end up needing to notify the user of the error and get input, so I may as well just use it if I can.

 

Thanks,

Stuart

0 Kudos
Message 1 of 4
(3,187 Views)

What error are you trying to avoid?

One way to do this is use If, Else, and wait functions to perform the opporation described in question 1.

The link below shows where to find the value for error results.
http://digital.ni.com/public.nsf/allkb/2C3445A795D7771886256B99007AC7F4

 

Have you looked through this tutorial?
http://www.ni.com/tutorial/27719/en/

0 Kudos
Message 2 of 4
(3,139 Views)

The error I'm trying to avoid is basically a USB enumeration thing, I'm power cycling some hardware and sometimes Windows is an idiot and takes forever to see it once it's back up. I don't really want to wait 10+ seconds when this normally takes <5, that adds nontrivial time to the overall test, I want to be able to retry a couple of times and if that doesn't work THEN throw the error.

 

Anywho, I think I worked it out on my own, though it's pretty kludgey. For the counter I have it set to change the ReportText in the Step parameter, the steps that tend to throw this error directly aren't in the Report anyway and TS doesn't seem to update that parameter at all if you don't tell it to. That lets me build an if/elseif tree that handles the various cases, though it's a little uglier than I really wanted (I could probably make it less ugly by being clever but I just wanted to get it working first).

 

I also realized that I could just look for the particular step name that threw the error rather than trying to parse the error text itself (both of which the SequenceFilePostStepRuntimeError callback tutorial actually had in it, inside the "Choose Action" step), but I may want to parse the error text later so it's good to know how to access it.

 

Finally, I discovered that the answer to my second question is "Just don't set the ErrorReported flag", so I don't actually need to include any logic for errors originating in steps that I haven't explicitly listed, if at the end of the callback that flag is still set (plus the various others that indicate there was an error) then the dialog still launches, you don't need to include an "Else" that does it.

 

So I think my questions are solved, though I'd definitely like to know if there's a better way to include a counter for how many times a given erroring step has been retried.

0 Kudos
Message 3 of 4
(3,136 Views)

It seems like your solutions is likely the easiest to implement, and as such might be the “best”. 

 

If you have any solutions that could be helpful to others in the future, I would attach them to make other’s lives easier. And mark your solution as correct.

0 Kudos
Message 4 of 4
(3,113 Views)