Name
On Error Statement
Synopsis
On
Error
Resume
Next
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 its subroutines, program execution returns to the statement immediately after the subroutine call in the routine containing theOn Error Resume Nextstatement.When used in an ASP page for IIS 5.0,
OnErrorResumeNextdisables ASP’s own error handling.
Programming Tips & Gotchas
If you have no error handling in your procedure, the VBScript runtime engine traces back through the call stack until a procedure is reached where error handling is enabled. In that case, the error ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access