Contents

cfcatch

Description

Catches exceptions that are thrown within a cftry tag. Can be used to handle built-in application exceptions or custom exceptions defined by the developer.

Category

Other

Implemented

Usage Syntax

<cfcatch  [type="String"]/>

[] = Optional attribute

Attributes

Name Type Required Default Description
type String No Type of catch, default:Any

Example Usage

Example 1:

<cftry>
	<cfthrow message="Testing a try block" />
	
	<cfcatch type="any">
		<p>
			Any error is handled here!
		</p>
	</cfcatch>
</cftry>

Example 2:

<cftry>
	<cfthrow message="Testing a try block" type="uncatchable" />
	
	<cfcatch type="uncatchable">
		<p>
			Only 'uncatchable' errors are handled here...
		</p>
	</cfcatch>
	
	<cfcatch type="any">
		<p>
			Any error is handled here!
		</p>
	</cfcatch>
</cftry>