<cffinally>
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.
This tag must have a body.
This tag is also supported within <cfscript>
<cffinally><!--- body ---></cffinally>
This tag does not use any attributes.
Examples
editTag Example
<cftry>
<cfset a = 2/0>
<cfdump var="#a#" />
<cfcatch type="any">
Caught an error.
</cfcatch>
<cffinally>
This is from cffinally.
</cffinally>
</cftry>
Script Example
try{
a = 2/0
writeDump("#a#");
}
catch(any e){
writeOutput("Caught an error.");
}
finally{
writeOutput("This is from finally.");
}
See also
- <cfcatch>
- <cfthrow>
- <cftry>
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)