O'Reilly logo

Active Server Pages 3.0 from Scratch by Nicholas Chase

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling Errors in ASP

The Err object is extremely handy because even if we tell the script to keep executing after an error, the Err object will keep track of the fact that the error occurred. It will also provide us with information about the error. In Listing 8.34, we add error checking to order_complete_action.asp.

Code Listing 8.34. order_complete_action.asp: Adding error checking
0: <%@ LANGUAGE="VBSCRIPT" %>
1: <!--#include file="adovbs.inc"-->
2: <!--#include file="pagetop.txt"-->
3: <!--#include file="isadmin.inc"-->
4: <%
5:    sub sub_ArchiveOrder (s_order_id, s_status)
…
52:           orderItemSet.MoveNext
53:        wend
54:
55:        orderItemSet.filter = 0
56:
57:        if Err.Number = 0 then
58:            'There were no errors
59:            Response.Write "Order number " & p_order_id ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required