Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trycf/45ac5c8ad2ce444eb24f4362191d518e to your computer and use it in GitHub Desktop.
Save trycf/45ac5c8ad2ce444eb24f4362191d518e to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
function foo(a){
if(a==1){
throw(message="Oops", detail="1", type="oneEX");
}
if(a==2){
throw(message="Oops", detail="2", type="twoEX");
}
if(a==3){
throw(message="Oops", detail="3", type="threeEX");
}
if(a==4){
throw(message="Oops", detail="4", type="fourEX");
}
}
g = "two"
</cfscript>
<cftry>
<cfset h = foo(2)>
<cfcatch name = "PIUTE" type = "#g#" >
<!--- The message to display. --->
<h3>You've Thrown a Database <b>Error</b></h3>
<cfoutput>
<!--- The diagnostic message from ColdFusion. --->
<p>#PIUTE.message#</p>
<p>Caught an exception, type = #PIUTE.TYPE#</p>
<p>The contents of the tag stack are:</p>
<cfdump var="#PIUTE.tagcontext#">
</cfoutput>
<cfdump var="
#PIUTE.Type#"> <cfdump var = "
#PIUTE.Message#"> <cfdump var = "
#PIUTE.ErrorCode#"> <cfdump var = "
#PIUTE.ExtendedInfo#">
</cfcatch>
</cftry>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment