OnLogError EventHandler Not working for app crash
I already know that my question will look odd to many but i have a test where i want to ensure that for a given condition my application would get closed if the user doesn't have specific authorizations.
Basically ill be killing my application in that condition and sometimes testcomplete will detect that the application crashed and therefore give me a "The XXX.exe process crashed." log error.
So i though that for that particular test i would simply add a OnLogError handler and verify this message and for that particular test simply put a warning instead.
This is my Handler:
function TestStopEventControl_OnLogError(Sender, LogParams) {
Log.Message("DEBUG: Inside OnLogError with message: '" + LogParams.MessageText + "' IgnoreVar:" + Project.Variables.ignoreAppCrashError);
// Check if the error message matches the specific crash string.
if (LogParams.MessageText == "The XXX.exe process crashed." && Project.Variables.ignoreAppCrashError) {
// Log a warning to indicate the error was suppressed.
Log.Warning(LogParams.MessageText);
// Suppress the error log by marking it as locked.
LogParams.Locked = true;
}
}
For all my log errors this code seems to be run since i see my DEBUG message.
However it doesn't work for the LogError im am trying to ignore....
And like i say, for any other error it seems to go inside the handler:
Im guessing those are "native" error and cannot be changed, but in my case it would have been necessary...
Any ideas?