<cfparam name="cfcatch.detail" default="" />That would be way too easy. I found a couple places that suggested using duplicate() to make it act like a struct. I tried that too, and you still can't do a cfparam on it. The key simply won't exist.
After much googling, I came across this post by Isaac Dealey. So using that idea, I created the following function:
<cffunction name="structifyCatch" returntype="struct">then to implement it, you call the following:
<cfargument name="catch" type="any" required="true"/>
<cfset var err = structnew() />
<cfset structappend(err,arguments.catch,true) />
<cfreturn err />
</cffunction>
<cftry>Hopefully this will save you a little bit of angst.
... some code ...
<cfcatch>
<cfset cfcatch = structifyCatch(cfcatch) />
<cfparam name="cfcatch.message" default=""/>
<cfparam name="cfcatch.detail" default=""/>
<cflog text="There was an error in somecode().
Message: #cfcatch.message# Detail: #cfcatch.Detail#"
application="yes">
</cfcatch>
</cftry>
There are some interesting behaviors documented here too:
cfcatch was born a struct, then it wasn’t but now it’s back
Blessings,
Terry