Suppressing Division By Zero error in ASP

ASP’s ability to trap for errors is pretty weak compared to other languages. However, you can trap for errors, suppress errors, and stop suppressing errors. When an error is found, you can also handle it.

Suppressing Errors

To start trapping errors, add the following line:

On Error Resume Next

This will suppress all errors for the duration of the script. For example, normally the following code would cause the death of your code with a division by error message:

Dim x
x = 1/0

However, you can suppress the error as follows:

On Error Resume Next
Dim x
x = 1/0

The above code will cause NO error at all.

 

.