User Guide

Generating Custom Error Messages with cferror 199
Generating Custom Error Messages with cferror
By default, ColdFusion uses a standard page for most errors. Custom error pages
allow you to control the error information that users see. You can specify custom
error pages for different types of errors and handle different types of errors in
different ways. For example, you can create specific pages to handle errors that could
be recoverable, such as request timeouts. You can also make your error messages
consistent with the look and feel of your application.
You can specify the following types of custom error pages:
You set the custom error application pages with the
cferror tag. You can set the
custom error application pages page-by-page, but because custom error pages
generally apply to an entire application, it is more efficient to include the cferror
tag in the Application.cfm file. After you create a custom error page, you must
include the cferror tag in your applications Application.cfm page. For more
information, see Understanding the Web Application Framework on page 214.
For detailed information on the cferror tag, see the CFML Reference.
Type Description
Validation Handles server-side form field data validation errors. The validation
error page cannot include CFML tags, but can display special error
page variables.
Exception Handles exception errors. You can specify different error pages for
different types of exceptions.
Request Handles any exception that is not otherwise handled. The request error
page runs after the CFML language processor finishes. As a result, the
request error page cannot include CFML tags, but can display error
page variables. A request error page is useful as a backup if errors
occur in other error handlers.
Monitor Handles exceptions before any other error-handling mechanism runs.
You can specify different monitor pages for different types of
exceptions.
When the monitor page completes, error handling continues with any
cftry/cfcatch code or other cferror error handlers for the error
type.
You should only use monitor handlers for debugging, for example, to
log error information, and not include them in production code.