Whatever message this page gives is out now! Go check it out!

cfrethrow

Last update:
May 18, 2026

Description

Rethrows the currently active exception. Preserves the exception's cfcatch.type and cfcatch.tagContext variable values.

Category

Syntax

<cfrethrow>

See also

cferrorcfthrowcftryHandling runtime exceptions with ColdFusion tags in the Developing ColdFusion Applications

Usage

Use this tag within a cfcatch block. This tag is useful in error handling code, if the error handler cannot handle an error that it catches. For example, if cfcatch type = "any" gets a DATABASE exception, and the code is designed to handle only CFX exceptions, the handler raises the exceptions again, with details intact, so that a higher-level handler can process the error information. If you used the cfthrow tag, the type and details of the original exception would be lost.

Example

<h3>cfrethrow Example</h3> 
<!--- Rethrow a DATABASE exception. ---> 
<cftry> 
<cftry> 
<cfquery name = "GetMessages" dataSource = "cfdocexamples"> 
SELECT* 
FROM Messages 
</cfquery> 
<cfcatch type = "DATABASE"> 
<!--- If database signalled a 50555 error, ignore; otherwise, rethrow 
exception. ---> 
<cfif cfcatch.sqlstate neq 50555> 
<cfrethrow> 
</cfif> 
</cfcatch> 
</cftry> 
<cfcatch> 
<h3>Sorry, this request can't be completed</h3> 
<h4>Catch variables</h4> 
<cfoutput> 
<cfloop collection = #cfcatch# item = "c"> 
<br> 
<cfif IsSimpleValue(cfcatch[c])>#c# = #cfcatch[c]# 
</cfif> 
</cfloop> 
</cfoutput> 
</cfcatch> 
</cftry>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page