
291
DEVELOPING
COLDFUSION 9 APPLICATIONS
Developing CFML Applications
Las
t
upda
te
d 8/5/2010
Expression exceptions
The following variable is only available for Expression exceptions:
Locking exceptions
The following additional information is available for exceptions related to errors that occur in
cflock
tags:
Missing include exceptions
The following additional variable is available if a missing file specified by a
cfinclude
tag causes the error.
Using the cftry tag: an example
The following example shows the
cftry
and
cfcatch
tags. It uses the cfdocexamples data source, which many of the
examples listed here use, and a sample included file,
includeme.cfm.
If an exception occurs when you run the
cfquery
statement, the application page flow switches to the
cfcatchtype
=
"Database"
exception handler. It then resumes with the next statement after the
cftry
block, once
the
cfcatchtype
=
"Database"
handler completes. Similarly, the
cfcatchtype
=
"MissingInclude"
block handles
exceptions raised by the
cfinclude
tag.
Property variable
Description
cfcatch.NativeErrorCode
The native error code associated with this exception. Database drivers typically provide
error codes to assist in the diagnosis of failing database operations. The values assumed by
cfcatch.NativeErrorCode
are driver-dependent.
If no error code is provided, the value of
cfcatch.nativeErrorCode
is -1. The value is 0
for queries of queries.
cfcatch.SQLState
The SQLState code associated with this exception. Database drivers typically provide error
codes to assist in the diagnosis of failing database operations. SQLState codes are more
consistent across database systems than native error codes.
If the driver does not provide an SQLState value, the value of
cfcatch.SQLState
is -1.
cfcatch.Sql
The SQL statement sent to the data source.
cfcatch.queryError
The error message as reported by the database driver.
cfcatch.where
If the query uses the cfqueryparam tag, query parameter name-value pairs.
Property variable
Description
cfcatch.ErrNumber
An internal expression error number, valid only when
type="Expression"
.
Property variable
Description
cfcatch.lockName
The name of the affected lock. This is set to "anonymous" if the lock name is unknown.
cfcatch.lockOperation
The operation that failed. This is set to "unknown" if the failed operation is unknown.
Property variable
Description
cfcatch.missingFileName
The name of the missing file.