Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save trycf/5722d81a36e4c27d0c236c870821bdb4 to your computer and use it in GitHub Desktop.

Select an option

Save trycf/5722d81a36e4c27d0c236c870821bdb4 to your computer and use it in GitHub Desktop.
TryCF Gist
<cftry>
<cfoutput>Outer try starts.<br></cfoutput>
<cfset local.retval = {}>
<cfset local.retval.status = "">
<Cfset local.retval.message = "">
<!--- Inner cftry block --->
<cftry>
<cfoutput>Inner try starts.<br></cfoutput>
<!--- This will cause an error --->
<cfset x = 10 / 0>
<cfoutput>Inner try ends.<br></cfoutput>
<cfcatch type="any">
<cfoutput>Inner catch: #cfcatch.message#<br></cfoutput>
<!--- Uncomment the next line to propagate the error to outer cfcatch --->
<!--- <cfthrow> --->
</cfcatch>
</cftry>
<cfoutput>Outer try ends.<br></cfoutput>
<cfcatch type="any">
<cfoutput>Outer catch: #cfcatch.message#<br></cfoutput>
</cfcatch>
</cftry>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment