Alexei Karas [TeamAQA]
Said:
I'm afraid that my answer will not make you happy, but:
-- It is near to impossible to handle runtime errors in VBScript;
-- 'On Error Resume Next' is not recommended to be used by all good
coding practices (not just for VBScript, but for VB as well);
I cannot really agree with this statement. I DO agree that you don't use On Error Resume Next in VB since you have something else to use Goto Line Label, and then VB will shoot the error up the call stack. But what is the alternative in VB Script? Just don't handle errors? If you are doing file i/o or database writes, you would be foolhardy not to build in error handling.
As you say, check for error *and immediately On Error Goto 0* so you are not inadvertently eating any other errors. One of the more frustrating days in my life was an asp developer who basically put an ON ERROR RESUME NEXT at the top of his asp page. Then proceeded to do a bunch of File i/o operations (including writing to the ROOT of the web server duh) and database writes. He wondered why he was losing data. But could not understand what was wrong.