Detecting When Exceptions Occur
To be able to handle errors gracefully, it is imperative that some mechanism exists to inform us developers when an error arises. Errors occurring in an ASP page can be detected in one of two ways: through the scripting language’s error-handling interface, or through ASP 3.0’s new ASPError object.
The VBScript and JScript 5.0 scripting engines both contain robust runtime error-detection mechanisms. ASP pages (or other scripts) created using either of these scripting languages can use the scripting language’s inherent error-handling capabilities to detect when errors occur. As we’ll see in Section 3.2.1, using either VBScript’s or JScript’s error-handling mechanisms often results in verbose, inelegant, and unreadable code when compared to the elegance of the ASPError object.
The ASPError object, which we’ll detail in Section 3.2.2, provides detailed information about an error that just occurred in an ASP page, including a description and line number. However, the ASPError object can only be used with IIS 5.0/ASP 3.0, which, of course, requires Windows 2000 as the web server. Therefore, if you are using Windows NT as your web server’s operating system, you must rely on the scripting languages’ error-handling techniques to detect and gracefully respond to exceptions.
If you are using Windows 2000, though, you are in luck. To use the ASPError object, a separate error-handling web page is needed. This separate page is responsible for receiving the detailed ...