You can have "On Error Resume Next" and write a bunch "If Err.Number <> 0" or some number and handle the error. Or you can say, "On Error GoTo 0" (or some exact line number, except you don't really know what the real line number is after the code is intepreted by the engine). Generally use GoTo 0, to turn off error handling and just fail out of the program if errors are encountered.
VBScritpt has 'dropped' some features of VB, one is going to a line number or a label. Though it still uses the same On Error syntax of VB, it only supports goto 0.
'On Error' statement is there to enable and disable run time error handling of VBScript. And, yes, when you call a function or a procedure error handling is enabled again so if necessary you have to disable it again.
Usually, you disable runtime error handling when working with external objects. Otherwise, even checking the validity of the object could generate a run time error. Typically, you leave error handling disabled for as short as possible time to caught other errors you may not check for.
Anthony, any reason why you have to put error handling for each line? Usually, you use it when validating something that may generate a run time error and then enable it again for VBScript to take care of it.
Yes, VBScript is very restrictive in many ways, but if you work in Windows, it is there in every system without any additional installs ...
well for any reason a line in the function fails there is no reason keep executing rest of the line in that function. I don't know where its going to fail. it could be object not found or any other reason. so if they had better handler then that would be much better else I have to write error handler myself for each scenario that I think it might fail which is TDS work.