In production code, I would always adopt a more robust stance such and always use Option Explicit and follow my own rules laid out in the final section. (4) In fact Just doing a Set lastErr = Err wont work because Err is an object, and all the Set does is to point lastErr to Err; it isn’t a copy. On Error Resume Next DoStep1 If Err.Number <> 0 Then WScript.Echo "Error in DoStep1: " & Err.Description Err.Clear End If DoStep2 If Err.Number <> 0 Then WScript.Echo "Error in DoStop2:" & Or what if the error source and description returned by VBScript aren’t very helpful in debugging? http://prcflow.com/vbscript-error/vbscript-error-handling-msdn.html
This is done by inserting a statement like the following at the start of a procedure:On Error Resume NextThis tells the VBScript engine that, should an error occur, you want it Oddly, it calls them "compiler errors," although VBScript is interpreted rather than compiled. Footnotes (1) Clearly I can’t know about all available books, but I have checked the ones available online at Books24x7 and none cover off this subject fully. Errors in ASP scripts are handled automatically by the web server in one of three ways: by sending a default message to the client, by sending the client the contents of
Also I never use If expression then but If expression = true then Reply Fabulous Adventures In Coding says: September 9, 2004 at 1:13 pm Reply Benjohn says: October 29, 2007 crack the automation or crack down.View all posts by Anurag Agarwal → Leave a comment Cancel reply Connect with: Your email address will not be published. Like all variables in VBscript it has a default value, and this is “Raise”. The two methods are:RaiseThe Err.
For example, the following line causes a runtime error because here syntax is correct but at runtime it is trying to call fnmultiply, which is a non-existing function: