User Guide

Table Of Contents
307
CHAPTER 14
Handling Errors
Macromedia ColdFusion MX includes many tools and techniques for responding to errors that
your application encounters. These tools include error handling mechanisms and error logging
tools. This chapter describes these tools and how to use them.
This chapter does not discuss techniques for preventing errors, including methods for specifying
user input validation. It also does not discuss code debugging. For information on user input
validation, see Chapter 26, “Introduction to Retrieving and Formatting Data,” on page 609 and
Chapter 27, “Building Dynamic Forms with cfform Tags,” on page 631. For information on
debugging, see Chapter 18, “Debugging and Troubleshooting Applications,” on page 423.
Contents
About error handling in ColdFusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Understanding errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Error messages and the standard error format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Determining error-handling strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Specifying custom error messages with the cferror tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Logging errors with the cflog tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
Handling runtime exceptions with ColdFusion tags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
About error handling in ColdFusion
By default, ColdFusion generates its own error messages when it encounters errors. In addition, it
provides a variety of tools and techniques for you to customize error information and handle
errors when they occur. You can use any of the following error-management techniques.
Specify custom pages for ColdFusion to display in each of the following cases:
When a ColdFusion page is missing (the Missing Template Handler page)
When an otherwise-unhandled exception error occurs during the processing of a page (the
Site-wide Error Handler page)
You specify these pages on the Settings page in the Server Settings are in the ColdFusion MX
Administrator; for more information, see the ColdFusion MX Administrator Help.