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


Exception handling tags, Extensibility tags



See also

cferror, cfthrow, cftry; Handling runtime exceptions with ColdFusion tags in the Developing ColdFusion Applications


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.


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