User Guide
Error Handling in ColdFusion 197
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, including the following techniques:
• You can specify custom pages for ColdFusion to display when a ColdFusion page
is missing or if it encounters an exception error during the processing of a page
(the Site-wide Error Handling page). You specify these pages on the ColdFusion
Administrator Server Settings page.
• You can use the
cferror tag to specify ColdFusion pages to handle specific types
of errors.
• You can use the
cftry, cfcatch, and cfthrow tags to catch and handle exception
errors directly.
The remaining sections in this chapter provide the following information:
• The basic building blocks for understating types of ColdFusion errors and how
ColdFusion handles them
• How to use the
cferror tag to specify error-handling pages
• Logging errors
• How to handle ColdFusion exceptions
Understanding ColdFusion errors
Before you can effectively managee ColdFusion errors, you must understand the
error types and how ColdFusion handles them.
ColdFusion error types
ColdFusion errors can help you to debug your application and provide feedback to
users. There are several types of errors in ColdFusion:
• Missing template These errors occur if ColdFusion Server gets a request for a
page that it cannot find.
• Validation These errors occur when a user violates the server-side form field
validation rules in a form being submitted. You specify server-side form
validation by using hidden form fields. Data validation errors should not be
confused with code validation.
• Exception Exceptions are events that disrupt an application’s normal flow of
instructions. There are three general types of exceptions:
− Error responses from external services, such as an ODBC driver or CORBA
server
− CFML errors or the results of
cfthrow or cfabort tags
− Internal errors in the ColdFusion Server