<CFERROR TYPE="err_type" TEMPLATE="path" MAILTO="email_address">
Provides the ability to display customized HTML pages when errors occur. This allows you to maintain a consistent look and feel within your application even when errors occur.
The type of error that this custom error page is designed to handle:
Application.cfm
file.
The relative path to the file containing the error page. Note that this page can only include the error variables described below and cannot include CFML tags.
The email address of the administrator who should be notified of the error. This value is available to your custom error page using the MailTo property of the error object, such as #Error.MailTo#.
The CFERROR tag is normally used to customize the error messages for all the pages in an application. As a result, you generally embed it in the Application.cfm
file. For more information about the Application.cfm
file, refer to Developing Web Applications with ColdFusion.
To help ensure that error pages display successfully, pages you specify with CFERROR should not be encrypted with the cfcrypt
utility.
The error page specified in the TEMPLATE attribute of the CFERROR tag may contain one or more error variables, which will be substituted by ColdFusion when an error is displayed. Beyond the specification of these variables, no other ColdFusion tags, such as CFIF, CFSET, and so on, may be used in the error page.
Error variables available when CFERROR uses TYPE="Request" are as follows:
Custom Error Pages where TYPE="Request" | |
---|---|
Error Variable | Description |
Error.Diagnostics | Detailed error diagnostics from ColdFusion Server. |
Error.MailTo | Email address of administrator who should be notified (corresponds to the value set in the MAILTO attribute of CFERROR). |
Error.DateTime | Date and time when the error occurred. |
Error.Browser | Browser that was running when the error occurred. |
Error.RemoteAddress | IP address of the remote client. |
Error.HTTPReferer | Page from which the client accessed the link to the page where the error occurred. |
Error.Template | Page being executed when the error occurred. |
Error.QueryString | URL query string of the client's request. |
Error variables available when CFERROR uses TYPE="Validation" are as follows:
Custom Error Pages where TYPE="Validation" | |
---|---|
Error Variable | Description |
Error.ValidationHeader | Text for header of validation message. |
Error.InvalidFields | Unordered list of validation errors that occurred. |
Error.ValidationFooter | Text for footer of validation message. |