<cfcatch>

Used only inside a <cftry>, the cfcatch tag catches and process exceptions.

By specifying the type of error with the type attribute, different types of exceptions can be handled differently.

This tag must have a body.

This tag is also supported within <cfscript>

<cfcatch name=string type=string ><!--- body ---></cfcatch>
Attribute Description
name
string, optional

The name for the struct containing the exception information

by default it is cfcatch (in Lucee, the cfcatch variable will also be populated)

Alias: variable

type
string, optional

Type of catch, default:Any

Examples

Simple example with cfcatch

<cftry>
  <cfset a = 3/0>
  <cfdump var="#c#" />  
  <cfcatch>
    <cfdump var="#cfcatch#">
  </cfcatch>
</cftry>

See also