CFCatch Not a Struct

I ran into an issue today where passing a cfcatch between methods returned a "not a struct" error. A quick Google search and I found a timely article on that described it exactly.

Posted by Daniel Short on Jul 30, 2009 at 10:04 AM | Categories: ColdFusion -


Ben Nadel

Ben Nadel wrote on 07/30/09 11:26 AM

I also ran into this recently in the OnError() event handler in Application.cfc. I put the Exception CFArgument type as "struct" and it thew the type error. Switch to "any" and it worked.
Aaron West

Aaron West wrote on 07/30/09 4:49 PM

As far as I know CFCATCH has not been a struct since the introduction of ColdFusion MX (version 6). It doesn't make any sense to me /why/ CFCATCH isn't a struct though; it really should be in my opinion. But, maybe I'm missing something.
Daniel Short

Daniel Short wrote on 07/31/09 6:52 AM

Agreed, especially since it identifies itself as a Struct when you dump it...
Rob Barthle

Rob Barthle wrote on 05/25/11 6:32 PM

Just ran across this issue in CF9, but figured out a workaround. Use duplicate() to make a copy of the CFCATCH scope and you can use that copy as a struct. Weird why the original CFCATCH still doesn't identify as a struct, but this got me around an issue.