Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Overview

Excerpt

Change the default error trapping.

By default, any error is trapped and shown the end user. This is great for development, but not so great for production. To change this behavior, edit the webroot/Application.cfm

...

and

...

find

...

the

...

onError

...

function.

...

Change

Code Block
xml
xml
<cfset super.OnError(argumentCollection=arguments) />
{/code}

Becomes
{code:xml}

Becomes

Code Block
xml
xml
              <!--- Call the main farcry Application.cfc --->
		<cfset var machineName = createObject("java", "java.net.InetAddress").localhost.getHostName() />
		<cfif machinename contains("<yourservername>")>
		  <cfsavecontent variable="errordump">
	            <cfoutput>
	               <h3>Error Overview</h3>
	               <pre>
	               Machine:   #variables.machineName#
	               Message:   #arguments.exception.Message#
	               Browser:   #cgi.HTTP_USER_AGENT#
	               DateTime:   #now()#
	               Host:      #cgi.HTTP_HOST#
	               HTTPReferer:   #cgi.HTTP_Referer#
	               QueryString:   #cgi.Query_String#
	               RemoteAddress:   #cgi.Remote_Addr#
	               </pre>
	            
	               <h3>Root Cause</h3>
	               <cfdump var="#arguments.exception#" label="Error Diagnostics">
	            </cfoutput>
	         </cfsavecontent>
			<cfmail from="info@batterytex.com" to="mailme@geodesicgrafx.com" subject="ERROR - batterytex.com" type="html">
			<cfoutput>
                          #errordump#
                        </cfoutput>
			</cfmail>
		<cfelse>
			<cfset super.OnError(argumentCollection=arguments) />
		</cfif>	
{/code}