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 HJCotton.net that described it exactly.

4 responses to “CFCatch Not a Struct”

  1. Ben NadelBen Nadel Says:
    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.
  2. Aaron WestAaron West Says:
    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.

    Aaron West Says:
    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.

  3. Daniel ShortDaniel Short Says:
    Agreed, especially since it identifies itself as a Struct when you dump it...
  4. Rob BarthleRob Barthle Says:
    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.

Leave a Reply

Leave this field empty:

Powered by Mango Blog.