Specifying a custom error page

You specify the custom error pages with the cferror tag. For Validation errors, the tag must be on the Application.cfm page. For Exception and Request errors, you can set the custom error pages on each application page. However, because custom error pages generally apply to an entire application, it is more efficient to put these cferror tags in the Application.cfm file also. For more information on using the Application.cfm page, see Designing and Optimizing a ColdFusion Application.

The cferror tag has the attributes listed in the following table:

Attribute Description

Type

The type of error that will cause ColdFusion to display this page: Exception, Request, or Validation.

Exception

Use only for the Exception type. The specific exception or exception category that will cause the page to be displayed. This attribute can specify any of the types described in About ColdFusion exceptions.

Template

The ColdFusion page to display.

MailTo

(Optional) An e-mail address. The cferror tag sets the error page error.mailTo variable to this value. The error page can use the error.mailTo value in a message that tells the user to send an error notification. ColdFusion does not send any message itself.

The following cferror tag specifies a custom error page for exceptions that occur in locking code and informs the error page of the of an e-mail address it can use to send a notification each time this type of error occurs:

<cferror type = "exception" 
exception = "lock"
template = "../common/lockexcept.cfm"
mailto = "[email protected]">

For detailed information on the cferror tag, see CFML Reference.

View comments on LiveDocs