Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Overview

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

<cfset super.OnError(argumentCollection=arguments) />

Becomes

              <!--- 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>	
  • No labels