Handling runtime exceptions with ColdFusion tags
299
Diagnostics: Cannot find CFML template for custom tag testCase. Cannot
find CFML template for custom tag testCase. ColdFusion attempted looking
in the tree of installed custom tags but did not find a custom tag with
this name."
The text consists of a comma delimited list of the following entries:
•
Log entry type, specified by the
cflog
type
attribute
•
ID of the thread that was executing
•
Date the entry was written to the log
•
Time the entry was written to the log
•
Application name, as specified by a
cfapplication
tag, normally in the Application.cfm file
•
The message specified by the
cflog
text
attribute.
Handling runtime exceptions with ColdFusion tags
Exceptions include any event that disrupts the normal flow of instructions in a ColdFusion page,
such as failed database operations, missing include files, or developer-specified events. Ordinarily,
when ColdFusion encounters an exception, it stops processing and displays an error message or an
error page specified by a
cferror
tag or the Administrator Site-wide Error Handler setting.
However, you can use the ColdFusion exception handling tags to catch and process runtime
exceptions directly in ColdFusion pages.
This ability to handle exceptions directly in your application pages enables your application to do
the following:
•
Respond appropriately to specific errors within the context of the current application page
•
Recover from errors whenever possible.
Exception-handling tags
ColdFusion provides the exception-handling tags listed in the following table:
Using cftry and cfcatch tags
The
cftry
tag allows you to go beyond reporting error data to the user:
•
You can include code that recovers from errors so your application can continue processing
without alerting the user.
•
You can create customized error messages that apply to the specific code that causes the error.
Tag
Description
cftry
If any exceptions occur while processing the tag body, look for a
cfcatch
tag that
handles the exception, and execute the code in the
cfcatch
tag body.
cfcatch
Execute code in the body of this tag if the exception caused by the code in the
cftry
tag body matches the exception type specified in this tag’s attributes.
Used in
cftry
tag bodies only.
cfthrow
Generate a user-specified exception.
cfrethrow
Exit the current
cfcatch
block and generates a new exception of the same type.
Used only in
cfcatch
tag bodies.
Summary of Contents for 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: ......