I've been working on a error handling application and ran into an issue. I could not pass along the CFCATCH scope as a struct as an argument. I could do it for any other scope. Testing revealed a weird oddity where ColdFusion does not see the CFCATCH scope as a struct.
Try this code
2 <cfthrow type="Application" message="This is a test error">
3 <cfcatch type="any">
4 <cfoutput>#isStruct(cfcatch)#</cfoutput>
5 <cfset variables.copyOfCactch = duplicate(cfcatch) />
6 <cfdump expand="true" label="cfcatch" var="#cfcatch#" />
7 <cfoutput>#isStruct(variables.copyOfCactch)#</cfoutput>
8 <cfdump expand="true" label="variables.copyOfCactch" var="#variables.copyOfCactch#" />
9 </cfcatch>
10</cftry>
and this is what it returns:
NO YES
(plus the related dumps)
#1 by Dan G. Switzer, II on 5/26/11 - 1:35 PM
The root cause is that CFCATCH isn't really a structure, but a Java exception that CF makes look like a struct.
Anyway, the problem that I was trying to tackle was how to alter the CFCATCH.message key, but keeping the stack trace intact. Here's how I solved it:
http://blog.pengoworks.com/index.cfm/2011/5/26/Mod...
#2 by Ben Nadel on 5/26/11 - 2:41 PM
#3 by Rob Barthle on 6/1/11 - 3:21 AM