BackUp LevelNext

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:

Usage

You must code at least one CFCATCH tag within a CFTRY block. Code CFCATCH tags at the end of the CFTRY block. Always code CFCATCH TYPE="ANY" last; ColdFusion tests CFCATCH tags in the order in which they appear in the page.

Applications can optionally use the CFTHROW tag to raise custom exceptions. Such exceptions are caught with either TYPE="APPLICATION" or TYPE="ANY".

The tags that throw an exception of TYPE="TEMPLATE" are CFINCLUDE, CFMODULE, and CFERROR.

An exception raised within a CFCATCH block cannot be handled by the CFTRY block that immediately encloses the CFCATCH tag.

You can use the CFCATCH variable to access exception information:




BackUp LevelNext

allaire

AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.