PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/wheels/events/onerror/cfmlerror.cfm

http://cfwheels.googlecode.com/
ColdFusion | 70 lines | 69 code | 0 blank | 1 comment | 1 complexity | 5d03f2f156bcedd3198ea6aa138991d7 MD5 | raw file
 1<cfoutput>
 2	<h1>Summary</h1>
 3	<p>
 4		<strong>Error:</strong><br />
 5		<cfif StructKeyExists(arguments.exception, "rootcause") and StructKeyExists(arguments.exception.rootcause, "message")>
 6			#arguments.exception.rootcause.message#
 7			<cfif arguments.exception.rootcause.detail IS NOT ""><br />#arguments.exception.rootcause.detail#</cfif>
 8		<cfelse>
 9			A root cause was not provided.
10		</cfif>
11	</p>
12	<cfif StructKeyExists(arguments.exception.cause, "tagContext") && ArrayLen(arguments.exception.cause.tagContext)>
13		<p><strong>Location:</strong><br />
14		<cfset loc.path = GetDirectoryFromPath(GetBaseTemplatePath())>
15		<cfset loc.pos = 0>
16		<cfloop array="#arguments.exception.cause.tagContext#" index="loc.i">
17			<cfset loc.pos = loc.pos + 1>
18			<cfset loc.template = Replace(arguments.exception.cause.tagContext[loc.pos].template, loc.path, "")>
19			<!--- show all non wheels lines --->
20			<cfif loc.template Does Not Contain "wheels" AND FindOneOf("/\", loc.template) IS NOT 0>
21				Line #arguments.exception.cause.tagContext[loc.pos].line# in #loc.template#<br />
22			</cfif>
23		</cfloop>
24		</p>
25	</cfif>
26	<cfif IsDefined("application.wheels.rewriteFile")>
27		<p>
28			<strong>URL:</strong><br />
29			#LCase(ListFirst(cgi.server_protocol, "/"))#://#cgi.server_name##Replace(cgi.script_name, "/#application.wheels.rewriteFile#", "")##cgi.path_info#<cfif cgi.query_string IS NOT "">?#cgi.query_string#</cfif>
30		</p>
31	</cfif>
32	<cfif Len(cgi.http_referer)>
33		<p><strong>Referrer:</strong><br />#cgi.http_referer#</p>
34	</cfif>
35	<p><strong>Method:</strong><br />#cgi.request_method#</p>
36	<p><strong>IP Address:</strong><br />#cgi.remote_addr#</p>
37	<p><strong>User Agent:</strong><br />#cgi.http_user_agent#</p>
38	<p><strong>Date & Time:</strong><br />#DateFormat(now(), "MMMM D, YYYY")# at #TimeFormat(now(), "h:MM TT")#</p>
39	<cfset loc.scopes = "CGI,Form,URL,Application,Session,Request,Cookie,Arguments.Exception">
40	<cfset loc.skip = get("excludeFromErrorEmail")>
41	<!--- always skip cause since it's just a copy of rootCause anyway --->
42	<cfset loc.skip = ListAppend(loc.skip, "exception.cause")>
43	<h1>Details</h1>
44	<cfloop list="#loc.scopes#" index="loc.i">
45		<cfset loc.scopeName = ListLast(loc.i, ".")>
46		<cfif NOT ListFindNoCase(loc.skip, loc.scopeName) AND IsDefined(loc.scopeName)>
47			<cftry>
48				<cfset loc.scopeCopy = Duplicate(Evaluate(loc.i))>
49				<cfif IsStruct(loc.scopeCopy)>
50					<cfset loc.keys = StructKeyList(loc.scopeCopy)>
51					<cfloop list="#loc.keys#" index="loc.j">
52						<cfif Left(loc.j, 6) IS "wheels">
53							<cfset StructDelete(loc.scopeCopy, loc.j)>
54						</cfif>
55					</cfloop>
56					<p><strong>#loc.scopeName#</strong>
57					<cfset loc.hide = "">
58					<cfloop list="#loc.skip#" index="loc.j">
59						<cfif loc.j Contains "." AND ListFirst(loc.j, ".") IS loc.scopeName>
60							<cfset loc.hide = ListAppend(loc.hide, ListRest(loc.j, "."))>
61						</cfif>
62					</cfloop>
63					<cfdump var="#loc.scopeCopy#" format="text" showUDFs="false" hide="#loc.hide#">
64					</p>
65				</cfif>
66				<cfcatch type="any"><!--- just keep going, we need to send out error emails ---></cfcatch>
67			</cftry>
68		</cfif>
69	</cfloop>
70</cfoutput>