04-20-2010 12:48 PM
I am doing some custom initialization in the process model (in the ProcessSetup callback). I call a .NET module that may throw an exception under certain error conditions. This causes the the process model to jump to the Cleanup section of the process model (not the client sequence file cleanup) and that's okay. The problem I have is that in my UI I am getting the AxAppMgr_ExecutionEnded event and the e argument's exec.ResultStatus property indicates "Passed". I want it to indicate "Error" or "Incomplete" or something other than passed. The client sequence never ran at all. While it had no failures, it could not have passed.
How do I force the status to be "Error" or something other than "Passed"?
Solved! Go to Solution.
04-22-2010 10:50 AM - edited 04-22-2010 10:50 AM
Before checking Execution.ResultStatus, you need to check Execution.ErrorObject to see if an error occurred and to get the error information if needed.
Do something like:
PropertyObjectPtr errorObject = execution->GetErrorObject();
if (errorObject->Exists("Occurred", 0) && errorObject->GetValBoolean("Occurred", 0))
{
_bstr_t msg = errorObject->GetValString("Msg", 0);
// Add whatever other code you want here.
}
Hope this helps,
-Doug
04-22-2010 11:56 AM
Hi Skeptical,
If I know how you are jumping to the cleanup after running your .NET code module it will help me reproduce this behavior and help resolve why it is "passing." After the .NET exception is thrown how are you handling that in a manner that jumps the code to cleanup. Are you catching that error in TestStand and causing a TestStand Run-Time error and then configuring the station options to jump to cleanup on a Run-Time error?
Thanks
04-26-2010 10:15 AM
Ryan,
I am just getting back to this. Thanks for the response.
I have my own sequence that gets called from ProcessSetup in the process model. That sequence sets up some station global variables for me including some Object References. One of the object references is a .NET object used to read a file. If that file does not exist, then the .NET object throws an exception which results in TestStand presenting a dialog with the error message and options about what to do next. I don't want our technicians getting that dialog box so I changed the Station Options to "Run Cleanup" on Run-time error.
The process model jumps to its Cleanup section when the run-time error is received.
Does that give you the information you need?
Incidentally, I am able to look at the e.exec.ErrorObject in the AxAppMgr_EndExecution event handler and I can see the error as suggested by Doug above.
Thanks.