|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
cfdump
Author: Mike Chabot
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32384#177687
Tony,
This issue has already been discussed a few times on this list. You
can use the search engine to find people's solutions. My solution was
to code my own CFDUMP tag, which is 90% the same as the original
CFDUMP, but has special handling for CFCATCH. The CFMX6.1 updater
includes a hotfix which changes the behavior of CFDUMP. It fixes the
dumping of some objects, while breaking the dumping of cfcatch.
Good luck,
Mike Chabot
Author: Tony Pimm
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32384#177638
Well it's rubbish, my code that used to simply try/catch a piece of code, if
there was an error, passed the cfcatch structure to a custom tag which then
handles it. It's now royally broken.
I've now either got to use the custom tag suggested above, or rely on cferror to
handle all my specific errors. Which is the wrong method, but about the only one
I can get working.
I would suggest MM gather a hotfix to resolve this problem, because I'm sure it
can't just be me encountering this problem.
Tony
----- Excess quoted text cut - see Original Post for more -----
type]
Author: Andreas Thomas
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32384#177476
I think this is sort of a "bugfix" in the updater for the endless loop error you
sometimes get when you try to dump an error which has a type of
"coldfusion.runtime.UndefinedElementException" or
"coldfusion.runtime.UndefinedVariableException".
>anyone ever get this when you <cfdump var="#cfcatch#">
>
>[unknown
type]
Author: Tony Pimm
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32384#177454
Hi Tony,
Yeah, I've noticed this a lot since the CFMX 6.1 Updater.
I never had this problem before applying the updater. It's now appearing all
over the place.
Have you found the cause for this yet, or any solutions?
Thanks.
Tony (another)
----- Excess quoted text cut - see Original Post for more -----
Author: Paul Kenney
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32384#162632
Tony,
I have a custom tag that I wrote to display exception information and it
catches some of the random error that happen when just cfdumping a cfcatch
variable. Call it like: <cf_showexception exception="#cfcatch#"/>
I put it below.
Paul Kenney
paul@pjk.us
916-212-4359
---START CODE---
<cffunction name="parseStackTrace" returntype="array" output="false">
<cfargument name="StackTrace" type="array" required="true"/>
<cfargument name="Mask" type="string" required="false"/>
<!--- --->
<cfset var aGroup = ArrayNew(1)>
<cfset var LineNumMask = "L" & RepeatString("0",
Len(toString(ArrayLen(Arguments.StackTrace))))>
<cfset var ElemMask = "[i] -- c.m( ) -- f:l">
<cfset var i = 0>
<cfset var j = 0>
<cfset var maskChar = "">
<cfset var Elem = StructNew()>
<cfset var ret = ArrayNew(1)>
<cfset Elem["Val"] = "">
<cfset Elem["Str"] = "">
<cfset Elem["Pos"] = "">
<cfset Elem["Class"] = "">
<cfset Elem["File"] = "">
<cfif StructKeyExists(Arguments, "Mask")>
<cfset ElemMask = Arguments.Mask>
</cfif>
<cfif NOT Len(ElemMask)>
<cfset ElemMask = "*">
</cfif>
<!--- Loop over the indexes of the "Arguments.StackTrace" array in reverse
order. --->
<cfloop index="j" from="#ArrayLen(Arguments.StackTrace)#" to="0"
step="-1">
<cfif NOT j OR ListFind("runFunction,runPage,service",
Arguments.StackTrace[j].getMethodName(), ",")>
<cfset ArrayPrepend(ret, aGroup)>
<cfif NOT j>
<cfbreak/>
</cfif>
<cfset aGroup = ArrayNew(1)>
</cfif>
<cfset Elem.Val = Arguments.StackTrace[j]>
<cfset Elem.Str = "">
<!--- Loop over the characters in the "ElemMask". --->
<cfloop index="i" from="1" to="#Len(ElemMask)#">
<cfscript>
maskChar = Mid(ElemMask, i, 1);
switch(maskChar)
{
case "c": // Class name
Elem.Str = Elem.Str & Elem.Val.getClassName();
break;
case "f": // Filename
Elem.Str = Elem.Str & Elem.Val.getFileName();
break;
case "i": // Current Index into the StackTrace array.
Elem.Str = Elem.Str & NumberFormat(j, LineNumMask);
break;
case "l": // Line number in file.
Elem.Str = Elem.Str & Elem.Val.getLineNumber();
break;
case "m": // Method name
Elem.Str = Elem.Str & Elem.Val.getMethodName();
break;
case "*":
Elem.Str = Elem.Str & Elem.Val.toString();
break;
default:
Elem.Str = Elem.Str & maskChar;
}
</cfscript>
</cfloop>
<cfset ArrayPrepend(aGroup, Elem.Str)>
</cfloop>
<cfreturn ret/>
</cffunction>
<cfparam name="Attributes.Exception" type="any" default=""/>
<cfif IsDebugMode()>
<cfif NOT IsSimpleValue(Attributes.Exception)>
<cfset catch = Attributes.Exception>
<cfelseif StructKeyExists(Caller, "cfcatch")>
<cfset catch = Caller.cfcatch>
<cfelse>
<cfexit method="exittag"/>
</cfif>
<cfelse>
<cfexit method="exittag"/>
</cfif>
<cfset ThisTag.Info = StructNew()>
<cfset ThisTag.Stacks = StructNew()>
<cfloop collection="#catch#" item="key">
<cfset Dest = "Info">
<cfset Value = "">
<cftry>
<cfswitch expression="#key#">
<cfcase value="StackTrace">
<cfinclude template="#Request.UDF#/us/pjk/debug/parseStackTrace.cfm"/>
<cfset Value = parseStackTrace(catch.StackTrace)>
<cfset Dest = "Stacks">
</cfcase>
<cfcase value="TagContext">
<cfset Value = catch[key]>
<cfset Dest = "Stacks">
</cfcase>
<cfcase value="objectType">
<cfif IsObject(catch[key])>
<cfset Value = catch.objectType.getName()>
<cfelse>
<cfset Value = catch.objectType>
</cfif>
<cfset Dest = "Info">
</cfcase>
<cfdefaultcase>
<cfset Value = catch[key]>
<cfset Dest = "Info">
<cfif IsObject(Value)>
<cfset Value = Value.toString()>
</cfif>
<cfif IsSimpleValue(Value)>
<cfset Value = ReplaceList(Value, ">,<,"", ">,<,""")>
</cfif>
</cfdefaultcase>
</cfswitch>
<cfset ThisTag[Dest][key] = Value>
<cfcatch type="any">
<!--- Do nothing here. --->
</cfcatch>
</cftry>
</cfloop>
<cfif StructKeyExists(ThisTag.Stacks, "TagContext") AND NOT
StructKeyExists(ThisTag.Info, "Template")>
<cfif IsArray(ThisTag.Stacks.TagContext) AND
ArrayLen(ThisTag.Stacks.TagContext)>
<cfset ThisTag.Info["Template"] = ThisTag.Stacks.TagContext[1].Template>
</cfif>
</cfif>
<cfif StructCount(ThisTag.Stacks)>
<cfset LeftWidth = "75%">
<cfset HeaderColSpan = "3">
<cfset ShowRight = TRUE>
<cfelse>
<cfset LeftWidth = "100%">
<cfset HeaderColSpan = "1">
<cfset ShowRight = TRUE>
</cfif>
<cfoutput>
<br><br>
<table border="1" cellpadding="5" cellspacing="0"
width="100%"><tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="2"
style="background:0000cc;color:ffffff;">
<tr><td align="center"><span style="font: bold 14pt Arial,
Helvetica,
sans-serif;">- EXCEPTION -</span></td></tr>
</table>
<br>
<table border="1" cellpadding="2" cellspacing="0" width="100%">
<tr><td>
<table>
<tr valign="top">
<td width="#LeftWidth#">
<cfdump var="#ThisTag.Info#" label="Exception Information"
expand="true"/>
</td>
<cfif ShowRight>
<td> </td>
<td><cfdump var="#ThisTag.Stacks#" label="Trace Information"
expand="false"/></td>
</cfif>
</tr>
</table>
</td></tr>
</table>
</td></tr></table>
</cfoutput>
<cfexit method="exittag"/>
Author: Tony Weeg
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32384#162627
it's a query...
that's wrapped in a cftry/cfcatch series of tags...
the error was in the sql code, and the cfdump didn't know
what to do with the error.
it was strange.
thanks
....tony
Tony Weeg
sr. web applications architect
navtrak, inc.
tony@navtrak.net
410.548.2337
www.navtrak.net
Ah, silly me. I was thinking about what you need to do to be able to
access the CFCATCH struct outside of the cfcatch opening and closing
tags... That is where your CFDUMP tag is, correct? Maybe pasting the
surrounding code would help...
uhhh I didn't have to yesterday.
is this something new today?
:) me
If I remember correctly, you have to Duplicate() the CFCATCH struct to
be able to dump it.
Author: Andrew Tyrone
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32384#162613
Ah, silly me. I was thinking about what you need to do to be able to access
the CFCATCH struct outside of the cfcatch opening and closing tags... That
is where your CFDUMP tag is, correct? Maybe pasting the surrounding code
would help...
uhhh I didn't have to yesterday.
is this something new today?
:) me
If I remember correctly, you have to Duplicate() the CFCATCH struct to be
able to dump it.
Author: Tony Weeg
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32384#162610
uhhh I didn't have to yesterday.
is this something new today?
:) me
If I remember correctly, you have to Duplicate() the CFCATCH struct to be
able to dump it.
anyone ever get this when you <cfdump var="#cfcatch#">
[unknown type]
thanks
...tony
tony weeg
senior web applications architect
navtrak, inc.
www.navtrak.net
tony@navtrak.net
410.548.2337
Author: Andrew Tyrone
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32384#162609
If I remember correctly, you have to Duplicate() the CFCATCH struct to be
able to dump it.
anyone ever get this when you <cfdump var="#cfcatch#">
[unknown type]
thanks
...tony
tony weeg
senior web applications architect
navtrak, inc.
www.navtrak.net
tony@navtrak.net
410.548.2337
Author: Tony Weeg
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:32384#162608
anyone ever get this when you <cfdump var="#cfcatch#">
[unknown type]
thanks
...tony
tony weeg
senior web applications architect
navtrak, inc.
www.navtrak.net
tony@navtrak.net
410.548.2337
|
May 24, 2012
|
Latest Fusion Authority Articles
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||