Specifying a custom error page

You specify the custom error pages with the cferror tag. For Validation errors, the tag must be in the Application.cfc initialization code or 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 place these cferror tags in the Application.cfc or Application.cfm file also. For more information on using these pages, 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 causes ColdFusion to display this page: Exception, Request, or Validation.

Exception

Use only for the Exception type. The specific exception or exception category that causes the page to display. 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 e-mail address to use to send a notification each time this type of error occurs:

<cferror type = "exception"  
    exception = "lock"      
    template = "../common/lockexcept.cfm" 
    mailto = "server@mycompany.com">

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