
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.
Содержание ColdFusion MX
Страница 1: ...Developing ColdFusion MX Applications...
Страница 22: ...22 Contents...
Страница 38: ......
Страница 52: ...52 Chapter 2 Elements of CFML...
Страница 162: ......
Страница 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Страница 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Страница 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Страница 266: ......
Страница 314: ...314 Chapter 14 Handling Errors...
Страница 344: ...344 Chapter 15 Using Persistent Data and Locking...
Страница 349: ...About user security 349...
Страница 357: ...Security scenarios 357...
Страница 370: ...370 Chapter 16 Securing Applications...
Страница 388: ...388 Chapter 17 Developing Globalized Applications...
Страница 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Страница 410: ......
Страница 426: ...426 Chapter 19 Introduction to Databases and SQL...
Страница 476: ...476 Chapter 22 Using Query of Queries...
Страница 534: ...534 Chapter 24 Building a Search Interface...
Страница 556: ...556 Chapter 25 Using Verity Search Expressions...
Страница 558: ......
Страница 582: ...582 Chapter 26 Retrieving and Formatting Data...
Страница 668: ......
Страница 734: ...734 Chapter 32 Using Web Services...
Страница 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Страница 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Страница 788: ......
Страница 806: ...806 Chapter 35 Sending and Receiving E Mail...