Skip to main content
Inspiring
October 13, 2008
Question

CFCatch type in CF8

  • October 13, 2008
  • 1 reply
  • 446 views
Is the CFCATCH structure no longer a struct?

I had the following in an error-handling tag in cf5:

<cfparam name="error" type="struct" default="#attributes.error#">

Where attributes.error was the result of a cftry/cfcatch block. Now I get the error:

"The passed value does not evaluate to a valid struct object "

So, what is cfcatch creating now?

Thanks,

Craig
    This topic has been closed for replies.

    1 reply

    Inspiring
    October 13, 2008
    If you run this code:

    {code}
    <cftry>
    <cfthrow>
    <cfcatch>
    <cfset o = cfcatch>
    </cfcatch>
    </cftry>

    <cfoutput>
    isStruct(o): #isStruct(o)#<br />
    isValid("struct", o): #isValid("struct", o)#<br />
    o.getClass(): #o.getClass()#<br />
    isObject(o): #isObject(o)#<br />
    </cfoutput>
    {code}

    You will get this:
    isStruct(o): NO
    isValid("struct", o): NO
    o.getClass(): class coldfusion.runtime.CustomException
    isObject(o): YES

    Same on CFMX7 and CF8.

    It's not a struct.

    --
    Adam
    CraigIWAuthor
    Inspiring
    October 14, 2008
    Well, that answers my initial question. What about the 2nd? What is cfcatch creating now? How can I use it within a cfparam tag?

    cfdump thinks it is a struct. I guess they should have created a new type, cfexception or something.

    Thanks,

    Craig