PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/wheels/events/onerror/wheelserror.cfm

http://cfwheels.googlecode.com/
ColdFusion | 37 lines | 37 code | 0 blank | 0 comment | 0 complexity | 0dd766f3817e2b76a99a7e3bfb4b83a0 MD5 | raw file
 1<cfoutput>
 2<h1>#arguments.wheelsError.type#</h1>
 3<p><strong>#REReplace(arguments.wheelsError.message, "`([^`]*)`", "<tt>\1</tt>", "all")#</strong></p>
 4<cfif StructKeyExists(arguments.wheelsError, "extendedInfo") AND Len(arguments.wheelsError.extendedInfo)>
 5	<h2>Suggested action</h2>
 6	<p>#REReplace(arguments.wheelsError.extendedInfo, "`([^`]*)`", "<tt>\1</tt>", "all")#</p>
 7</cfif>
 8<cfset loc.path = GetDirectoryFromPath(GetBaseTemplatePath())>
 9<cfset loc.errorPos = 0>
10<cfloop array="#arguments.wheelsError.tagContext#" index="loc.i">
11	<cfset loc.errorPos = loc.errorPos + 1>
12	<cfif loc.i.template Does Not Contain loc.path & "wheels" AND loc.i.template IS NOT loc.path & "root.cfm" AND loc.i.template IS NOT loc.path & "index.cfm" AND loc.i.template IS NOT loc.path & application.wheels.rewriteFile AND loc.i.template IS NOT loc.path & "Application.cfc" AND loc.i.template Does Not Contain loc.path & "plugins">
13		<cfset loc.lookupWorked = true>
14		<cftry>
15			<cfsavecontent variable="loc.fileContents"><cfset loc.pos = 0><pre><code><cfloop file="#arguments.wheelsError.tagContext[loc.errorPos].template#" index="loc.i"><cfset loc.pos = loc.pos + 1><cfif loc.pos GTE (arguments.wheelsError.tagContext[loc.errorPos].line-2) AND loc.pos LTE (arguments.wheelsError.tagContext[loc.errorPos].line+2)><cfif loc.pos IS arguments.wheelsError.tagContext[loc.errorPos].line><span style="color: red;">#loc.pos#: #HTMLEditFormat(loc.i)#</span><cfelse>#loc.pos#: #HTMLEditFormat(loc.i)#</cfif>#Chr(13)##Chr(10)#</cfif></cfloop></code></pre></cfsavecontent>
16		<cfcatch>
17			<cfset loc.lookupWorked = false>
18		</cfcatch>
19		</cftry>
20		<cfif loc.lookupWorked>
21			<h2>Error location</h2>
22			<p>Line #arguments.wheelsError.tagContext[loc.errorPos].line# in #Replace(arguments.wheelsError.tagContext[loc.errorPos].template, loc.path, "")#</p>
23			#loc.fileContents#
24		</cfif>
25		<cfbreak>
26	</cfif>
27</cfloop>
28<cfif ArrayLen(arguments.wheelsError.tagContext) gte 2>
29	<h2>Tag context</h2>
30	<p>
31	Error thrown on line #arguments.wheelsError.tagContext[2].line# in #Replace(arguments.wheelsError.tagContext[2].template, loc.path, "")#<br /> <!--- skip the first item in the array as this is always the $throw() method --->
32	<cfloop from="3" to="#ArrayLen(arguments.wheelsError.tagContext)#" index="loc.i">
33		- called from line #arguments.wheelsError.tagContext[loc.i].line# in #Replace(arguments.wheelsError.tagContext[loc.i].template, loc.path, "")#<br />
34	</cfloop>
35	</p>
36</cfif>
37</cfoutput>