Forum Discussion
I tried a similar deal with a JavaScript runtime error and got the same results. And I think I know why.
Microsoft VB Script Runtime errors and JavaScript runtime errors and similar errors don't play the same game as other types of errors that may occur during a test run. While they show up in the log as an "Error" log type, they don't execute through the same code and, therefore, don't actually trigger an OnLogError event.
So, while your code is 100% correct... because the event doesn't trigger, you'll never get what you want. Those two error types kill the test run immediately, no matter what.
If you want to actually do something when the test automation fails with either of those two errors, I'd suggest you look into implementing the OnStopTest event handler. You don't have access, necessarily, to the contents of the log so you won't be able to detect WHY the test stopped, just that it stopped. Give that a try.