NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Error Handling

Solved!
Go to solution

Hello,

 

I would like to create a custom error handler in a model file similar to the ErrorHandlerExample.seq.

 

In my case, I will be handing errors genereated in several different dlls.  We are trying to avoid writing wrappers around the dll functions to fill in the TestStand error strings.  However, this information is available by calling a "get error message" function in the dll.  Since I have more than one dll and more than one handle that I will need to check the errors for, I need to know the information about the step that caused the error.  Is there a way to get more information about the step that caused the error?  I might have a dll function call that had the format: 

 

kiOpenVSA(StationGlobals.KiManager, StationGlobals.VsaSession, StationGlobals.VsaResourceString, StationGlobals.DisplayEnable, StationGlobals.SendInitCommands)

 

Based on the parameters of the function call, I would be able to call the correct error handling function.

 

Thanks,

Mike

0 Kudos
Message 1 of 5
(3,920 Views)

Hi,

 

What particular information about the step do you need to know?

 

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 5
(3,916 Views)

I would need to know the name of the DLL that was called and also the names of the parameters that were sent in the call.  I think I could get the parameters from the text of the function call shown in the original post.

 

MIke

0 Kudos
Message 3 of 5
(3,903 Views)

Hi Mike,

 

If you want to pragmatically get the name of the DLL file, DLL function and parameters that were called in a previous step, you will first need to reference the step in which the DLL call was made and use the following TestStand API.

 

Assuming that the DLL was called in the previous step you can use the following expressions using TestStand 4.1.

 

Access the dll function expression

RunState.PreviousStep.Module.CommonCModule.FunctionCall

 

Access the dll function name

RunState.PreviousStep.Module.CommonCModule.FunctionName 

 

Access the parameters

RunState.PreviousStep.Module.AsDllModule.Parameters.item(index)

 

Note that if you are using an older version of TesStand, these functions may not work and you may have to use the ActiveX/COM steps to access this information.

 

I hope this helps.  

Message Edited by S_Hong on 02-10-2009 05:02 PM
Message Edited by S_Hong on 02-10-2009 05:07 PM
S_Hong
National Instruments
Applications Engineer
Message 4 of 5
(3,889 Views)
Solution
Accepted by topic author Mike_Millhaem

This looks exactly like what I need.  I'll try it out and let you know how it works.

 

Thanks,

Mike

0 Kudos
Message 5 of 5
(3,881 Views)