Hi Folks
In CF4.5 I could get a really nice, detailed stack trace when errors
occurred. If there is a trick to getting them back easily in CF5, I'd love
to hear it.
We have a site-wide error handler installed and it dumps things from the
error object (including error.diagnostics, which is where I used to see the
trace). I see the original template name in error.template, but now, with
CF5, I only get what looks like a partial trace, after the first cfcatch.
(look below)
I have the "Enable CFML Stack Trace" option turned on in the Debugging
Options, but I noticed the wording below it says:
"In case of a CFML structured exception, fills in CFCATCH.TAGCONTEXT with
information about the tags that were executing when ColdFusion detected the
exception."
I don't know if that is what it use to say, but it sounds different. (It
turns out that this setting can be used for a work-around.)
Below is an example ERROR.DIAGNOSTICS message for a case where a wddx error
was cfcatch'ed and rethrown. It does have a bit of a stack track
(basically, the cfcatch itself) but does not show the original page template
name and calling line number, not to mention the 2 or three layers of custom
tags in between.
----
unknown element encountered
The error occurred while processing an element with a general identifier of
(CFWDDX), occupying document position (61:3) to (61:113) in the template
file d:\inetpub\cf_CustomTags\WddxCapture.cfm.
The error occurred while processing an element with a general identifier of
(CFRETHROW), occupying document position (77:4) to (77:14) in the template
file d:\inetpub\cf_CustomTags\WddxCapture.cfm.
----
I did find a work-around... in the cfcatch I stuff CFCATCH.TAGCONTEXT into a
REQUEST variable, and then use the code below to report it in the site-wide
error handler. The code produces a slimmed down version of the full stack
trace up to the cfcatch. (You can use cfdump to look at the whole thing).
<!--- dump the stack trace, but only one entry per template --->
<cfloop index="i" from="1" to="#ArrayLen(request.error_stack)#">
<cfif (i eq ArrayLen(request.error_stack)) OR
(request.error_stack[i].TEMPLATE NEQ
request.error_stack[i+1].TEMPLATE)>
<LI>Line #request.error_stack[i].Line#,
#request.error_stack[i].TEMPLATE#
(#request.error_stack[i].ID#)
</cfif>
</cfloop>
This works ok but it requires that the REQUEST variable be set in every
single CFCATCH, and that sucks. Maybe I'm supposed to use some new mechanism
in CF5??
I also discovered that there is zero documentation on macromedia's site
about TAGCONTEXT, and error handling in general. Oh well.
Thanks
Mark
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists