CFTRY/CFCATCH

Used with one or more CFCATCH tags, the CFTRY tag allows developers to catch and process exceptions in ColdFusion pages. Exceptions include any event that disrupts the normal flow of instructions in a ColdFusion page such as failed database operations, missing include files, and developer-specified events.

Syntax

<CFTRY>
… Add code here
<CFCATCH TYPE="exceptiontype">
… Add exception processing code here
</CFCATCH>
… Additional CFCATCH blocks go here
</CFTRY>
TYPE

Optional. Specifies the type of exception to be handled by the CFCATCH block:

  • APPLICATION (default)

  • Database

  • Template

  • Security

  • Object

  • MissingInclude

  • Expression

  • Lock

  • Custom_type

  • Any (default)

Usage

You must code at least one CFCATCH tag within a CFTRY block. Code CFCATCH tags ...

Get Sams Teach Yourself ColdFusion® in 21 Days 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.