![MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual Download Page 119](http://html1.mh-extra.com/html/macromedia/coldfusion-4-5-developing-web/coldfusion-4-5-developing-web_develop-manual_3286369119.webp)
Chapter 8: Debugging and Error Handling
93
Generating Custom Error Messages (CFERROR)
ColdFusion displays error pages that can help you to debug your application. There are
four types of errors in ColdFusion:
•
REQUEST
— Request errors occur when a application page is requested and
there is an error in the page's code.
•
VALIDATION
— Validation errors occur when a user violates the form field
validation rules during a form submittal.
•
EXCEPTION
— Exception errors handle exceptions.
•
MONITOR
— Sets up an exception monitor.
By default, ColdFusion returns a standard page for these errors. But you may want to
customize the error pages that are returned, to make them consistent with the look
and feel of your application. Custom error pages also allow you to control the error
information that users see, as well as offering work-arounds or ways for users to report
the errors.
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 application's
Application.cfm
page. See
“Understanding
the Web Application Framework” on page 184
for more information.
For information on the syntax of the CFERROR tag, see the CFML Language Reference.
Creating an error application page
The error application page is a file that includes HTML and the parameters associated
with the error. The error application page cannot use any CFML tags.
The parameters associated with an error depend on the type of error. All the error
parameters use the Error prefix (for example,
Error.Diagnostics
).
See the CFML Language Reference for more information on the error variables and on
using the CFERROR tag.
The following examples show the two types of custom error pages.
Example of a request error
The following example shows a custom error page for a request error:
<HTML>
<HEAD>
<TITLE>Products - Error</TITLE>
</HEAD>
<BODY>
<CFOUTPUT>
<H2>Sorry</H2>
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...