Name

CFTRY

Synopsis

<CFTRY>
CFML
<CFCATCH TYPE="exception_type">
HTML and CFML
</CFCATCH>
<CFCATCH TYPE="exception_type">
HTML and CFML
</CFCATCH>
...
</CFTRY>

Traps and processes predefined and developer-specified exceptions within ColdFusion templates. The CFTRY/CFCATCH tags allow you to handle exceptions in your templates gracefully, without having to abort processing. Exceptions occurring within CFCATCH blocks can’t be handled by the same CFTRY block governing the CFCATCH block. At least one CFCATCH block must be nested within a CFTRY block. CFCATCH tags are processed in the order in which they are coded within a template.

Attributes

TYPE=" exception_type "

Specifies the type of exception to trap. Valid entries are:

Application

Catches application-level exceptions defined using the Application type in the CFTHROW tag.

Any (default)

Catches unexpected exceptions. This exception type should be coded as the last CFCATCH within a CFTRY block.

CustomType

Catches developer-specified exceptions as defined with the CFTHROW tag.

Database

Catches exceptions raised when interacting with data sources.

Expression

Catches exceptions that occur when an expression’s evaluation results in an error.

Lock

Catches exceptions associated with the CFLOCK tag such as timeouts, etc.

MissingInclude

Catches exceptions that occur when an included template isn’t found. This exception type covers exceptions thrown by the CFINCLUDE, CFMODULE, and CFERROR tags.

Object

Catches exceptions associated with ...

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.