Used inside a cftry tag. Code in the cffinally block is processed after the main cftry code and, if an exception occurs, the cfcatch code. The cffinally block code always executes, whether or not there is an exception.


Exception handling tags


try code <cfcatch>
catch code <cfcatch>
final code </cffinally>

See also

cftrycfcatchcferrorcfrethrowcfthrowonErrorHandling Errors in the Developing ColdFusion Applications


ColdFusion 9: Added the tag


The cffinally tag is optional in a cftry block, and the block can have only one cffinally tag. Put the cffinally tag at the end of all cftry block, after any cfcatch blocks. This tag requires an end tag. You can nest cftry/cfcatch/cffinally blocks.Use the cffinally tag for code that should execute whether or not an exception occurs. For example, use it to free up resources.


<h3>cffinally Example</h3>
<!--- Open a cftry block. --->
<cfcatch type = "Database">
<!--- Do some cleanup here before leaving cftry block --->

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy