O'Reilly logo

Programming ColdFusion by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required