On Error Resume Next statement _asp base

Source: Internet
Author: User
Tags error handling
Enable or disable an error handler.

Description
If the On Error Resume Next statement is not used in your code, the Run-time error that occurs will display an error message, and the execution of the code is terminated. However, the specific operation is determined by the host running the code. A host can sometimes selectively handle various types of errors. In some cases, it can activate the script debugger in the wrong place. In other cases, because the host cannot notify the user, there is no explicit explanation for the error that occurred. How you handle errors depends entirely on the capabilities of the host.

In any particular process, the error that occurs when an error handler is enabled on the call stack is generally not fatal. If a local error handler is not enabled in one procedure, when an error occurs, the control can be transferred through the stack call until a procedure with an error handler is found and the error is handled where it goes wrong. If an error handler is not found in the call stack, an error message is displayed in the wrong place, terminating the execution of the code, or handling the error correctly through the host.

On Error Resume Next causes the program to continue executing according to the statement following the statement that generated the error, or in accordance with the statement in the procedure that was last called, which contains the On Error Resume Next statement. This statement can continue executing the program regardless of run-time errors, and you can then create an error-handling routine inside the procedure. The On Error Resume Next statement becomes inactive when another procedure is invoked. Therefore, if you want to make internal error handling in a routine, you should execute the On Error Resume Next statement in each calling routine.

The On Error Resume Next statement is prohibited when another procedure is invoked, so if you want to embed an error handler in a routine, you need to perform an on error Resume Next statement each time the routine is invoked. When you exit a procedure, the error handler can revert to its state before it enters the exiting process.

If you have enabled the On Error Resume Next fault handler, you can disable the error handler using On Error GoTo 0.

<%
If Err. Number <> 0 Then
Response.Write "Number =" & Err. Number & "<p>"
Response.Write "Description =" & Err. Description & "<p>"
Response.Write "Source =" & Err. Source
Err. Clear
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.