try {
writeOutput('hello world<br/>');
throw(message='threw on purpose!');
}catch(any e){
writeOutput('Caught an exception<br/>');
}finally{
writeOutput('Ran clean-up code regardless of error');
}
Expected Result: hello world Caught an exception Ran clean-up code regardless of error
<cftry>
hello world<br/>
<cfthrow message="threw on purpose!" />
<cfcatch type="any">
Caught an exception<br/>
</cfcatch>
<cffinally>
Ran clean-up code regardless of error
</cffinally>
</cftry>
Expected Result: hello world Caught an exception Ran clean-up code regardless of error
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.