Name
On Error Statement
Syntax
On Error Resume Next On Error Goto 0
Description
Enables or disables error handling within a procedure. If you
don’t use an On Error statement in your procedure, or if
you have explicitly switched off error handling, the VBScript
runtime engine handles the error automatically. First, it displays a
dialog containing the standard text of the error message, something
many users are likely to find incomprehensible. Second, it
terminates the application, so any error that occurs in the
procedure produces a fatal runtime error.
Rules at a Glance
When a runtime error occurs in the routine in which the
OnErrorResumeNextstatement occurs, program execution continues with the program line following the line that generated the error. This means that, if you want to handle an error, this line following the line that generated the error should call or include an inline error-handling routine.When a runtime error occurs in any routine called by the routine in which the
On Error Resume Nextstatement occurs, or by its subroutines, program execution returns to the statement immediately after the subroutine call in the routine containing theOnErrorResumeNextstatement.When used in an ASP page for IIS 5.0,
OnErrorResumeNextdisables ASP’s own error handling.You disable error handling by using the
OnErrorGoto0statement.
Programming Tips and Gotchas
If you have no error handling in your procedure, the VBScript runtime engine traces back through the call stack until ...