This page demonstrates the Microsoft Events Site Error-Trapping Sample for trapping run-time scripting errors. It serves the double-duty of showing you their error pages and demo'ing how to use their sample code.
Download the files used for this sample.
If you enter a run-time script error number in the editbox below and click the "Submit Error" button, this page will call the VBScript Err.Raise function with your error code. That will generate a real run-time script error as if it had actually occurred in the process of executing a VBScript script statement. As you can see when you view the source code for this page (it's in the above download), all we had to do to make this work was include the trapError.asp file like this:
<%' ***************************************************************** ' * Include trapError.asp to handle the script errors on this page* ' *****************************************************************%> <!--#include file = "trapError.asp" -->
Refer to Microsoft Script Engine Error Codes if you'd like to review the list of run-time script error codes. The sample error-handler procedure in trapError.asp filters all possible run-time errors into one of three error pages that are presented to users when that error occurs. You can also just enter '1', '2', or '3' (without the ' characters) in the editbox to skip the filtering code and just show the error pages.
Please enter the run-time script error number you would like generate: