Exception Handling Strategies; Exception Handling Example - MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual

Table of Contents

Advertisement

208
Locking exceptions
The following additional information is available for exceptions related to
sections:
Property variable
cfcatch.lockName
cfcatch.lockOperation
Missing include exceptions
The following additional variable is available if the error is caused by a missing file
specified by a
Property variable
cfcatch.missingFileName

Exception handling strategies

Use
application page, or based on diagnostic information.
Use the
exception handling. When an application page raises an error condition, the
ColdFusion Server checks the stack of currently active blocks for a corresponding
cfcatch
exception-prone tag in a specialized combination of
immediately isolate the tag's exceptions, or to use
a main processing level to gracefully terminate a subsystem's processing in case of
an unexpected error.

Exception handling example

The following example shows
source used in many of the examples in this book and a sample included file,
includeme.cfm.
If an exception occurs during the
page flow switches to the
resumes with the next statement after the
type
Similarly, the
the
by the
cfinclude
with
cftry
cfcatch
tag with one or more
cftry
handler. In particularly problematic cases, you might enclose an
=
handler completes.
"Database"
cfcatch type
tag. Any unknown, but possibly recoverable, exceptions are handled
cfinclude
=
cfcatch type
"Any"
Chapter 11 Preventing and Handling Errors
Description
The name of the affected lock. This is set to
"anonymous" if the lock name is unknown.
The operation that failed. This is set to "unknown" if the
failed operation is unknown.
tag:
Description
The name of the missing file.
to handle exceptions based on their point of origin within an
cfcatch
and
cftry
cfcatch
statement's execution, the application
cfquery
=
cfcatch type
"Database"
cftry
=
"MissingInclude"
block.
blocks to define a ColdFusion block for
and
cftry
cfcatch
with
cftry
cfcatch type="Any"
, using the CompanyInfo data
exception handler. It then
block, once the
cfcatch
block handles exceptions raised by
cflock
to
at

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 5

Table of Contents