294
Chapter 14: Handling Errors
Specifying custom error messages with cferror
Custom error pages let you 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
time-outs. 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 message pages:
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
Chapter 13, “Designing and
Optimizing a ColdFusion Application,” on page 267
.
The
cferror
tag has the attributes listed in the following table:
Type
Description
Validation
Handles server-side form field data validation errors. The validation error page
cannot include CFML tags, but it can display error page variables.
You can use this attribute only on the Application.cfm page. It has no effect when
used on any other page. Therefore, you can specify only one validation error page
per application, and that page applies to all server-side validation errors.
Exception
Handles specific exception errors. You can specify individual 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.
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” on page 288
.
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.
Summary of Contents for COLDFUSION MX 61-DEVELOPING COLDFUSION MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......