Skip to Main Content
Programming ColdFusion MX, 2nd Edition
book

Programming ColdFusion MX, 2nd Edition

by Rob Brooks-Bilson
August 2003
Intermediate to advanced content levelIntermediate to advanced
1140 pages
68h 45m
English
O'Reilly Media, Inc.
Content preview from Programming ColdFusion MX, 2nd Edition

Chapter 9. Error and Exception Handling

Structured exception handling lets you gracefully catch and handle exceptions that occur in your ColdFusion applications. Exceptions can include anything from a page timeout or a missing file to a database error or a problem with an external object. Using the techniques discussed in this chapter, you can build extremely robust exception-handling capabilities into your ColdFusion applications.

There are a number of different levels at which you can handle exceptions and errors in a ColdFusion application. At the most basic level, you can use the cftry and cfcatch tags in a template, to test for and trap exceptions right where they occur. With the cfthrow tag, you can also define, throw, and catch custom exceptions in your application.

Of course, catching every exception when it occurs can become quite tedious, so ColdFusion provides a couple of different mechanisms for handling exceptions at a higher level. With the cferror tag, you can define generic error handlers for different kinds of errors. The cferror tag is normally used in the Application.cfm template, so that error handling occurs in the context of the Web Application Framework. This ability to provide “catch all” error handling for an application is quite convenient and powerful.

In addition, a site administrator can set up error and exception handling at the server level, using the ColdFusion Administrator. We’ll cover all these different techniques for error and exception handling ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming ColdFusion

Programming ColdFusion

Rob Brooks-Bilson

Publisher Resources

ISBN: 0596003803Supplemental ContentErrata Page