Hi I am trying to implement a site-wide error handler for a dedicated server 
running only 2 related aplications on a Coldfusion 7/Win2k3 setup.
I have been trying to use the code I found at 
'http://mysecretbase.com/building_a_coldfusion_error_handler.cfm'. All works 
fine up to a point. This error handler basically executes a generic error.cfm 
page which in turn includes a datadump page, that has options for handling the 
error data, and then includes my pretty looking error page informaing the user 
that an error has occurred. The problem is my pretty error page does not get 
display, the egenric ugly coldfusion page always appears and I do not know why. 

My error.cfm page has the following code;

<cfswitch expression="#cgi.Server_Name#">
   <cfcase value="mydomain.com,anotherdomain.com">
      <cfparam 
         name="request.dumpMode" 
         default="STANDARD" 
         type="string">
      <cfscript>
      request.emailTo="[EMAIL PROTECTED]";
      request.emailFrom="[EMAIL PROTECTED]";
      request.emailServer="mail.mydomain.com";
      </cfscript>
      <cfinclude template="dumpmonger.cfm">
      <cfinclude template="error_dsp01.cfm">
      </cfcase>
   <cfcase value="yetanotherdomain.com">
      <cfparam 
         name="request.dumpMode" 
         default="ONSCREEN" 
         type="string">
   </cfcase>
   <cfdefaultcase>
      <cfparam 
         name="request.dumpMode" 
         default="SECURE" 
         type="string">
      <cfscript>
      request.emailTo="[EMAIL PROTECTED]";
      request.emailFrom="[EMAIL PROTECTED]";
      request.emailServer="mail.foohbar.gov";
      </cfscript>
      <cfinclude template="dumpmonger.cfm">
      <cfinclude template="error_dsp02.cfm">
   </cfdefaultcase>
</cfswitch>

My datadump page has the following code;

<cfparam name="request.dumpMode" default="" type="string">
<cfparam name="request.emailTo" default="" type="string">
<cfparam name="request.emailFrom" default="" type="string">
<cfparam name="request.emailServer" default="" type="string">
<cflock scope="SERVER" type="READONLY" timeout="10">
 <cfset variables.CFVer=Left(server.coldfusion.ProductVersion,1)>
</cflock>
<cfscript>
request.vars="CFCATCH,ERROR,APPLICATION,ATTRIBUTES,CALLER,CGI,
              CLIENT,FORM,REQUEST,SESSION,THIS,THISTAG,URL,VARIABLES";
request.theFileName=Replace(CreateUUID(),"-","","all");
request.errorDirectory="c:/cfusionmx/wwwroot/myerrors/";
request.errorDomain="https://www.mydomain.com/errors/";;
</cfscript>
<cfsavecontent variable="variables.dataDump">
<cfloop 
  list="#request.vars#" 
   index="loopItem">
   <cfif IsDefined("#loopItem#")>
      <cfif Compare(variables.CFVer,6) OR Compare(variables.CFVer,7)>
         <br><br><cfoutput><b>#loopItem#</b></cfoutput>
      </cfif>
      <cfdump 
         var="#Evaluate(loopItem)#" 
         label="#loopItem#">
   </cfif> 
</cfloop>
</cfsavecontent>
<cffile 
   action="write" 
   file="#request.errorDirectory##request.theFileName#.html" 
   output="#variables.dataDump#">
<cfswitch expression="#request.dumpMode#">
   <cfcase value="STANDARD">
      <cfmail
         to="#request.emailTo#"
         from="#request.emailFrom#"
         subject="#cgi.server_name# Error"
         server="#request.emailServer#"
         type="HTML" 
         mimeattach="#request.errorDirectory##request.theFileName#.html">
         <p>
         <a href="#request.errorDomain#list.cfm">
         See complete error list
         </a>
         </p>
      </cfmail>
   </cfcase>
   <cfcase value="SECURE">
      <cfmail 
         to="#request.emailTo#"
         from="#request.emailFrom#"
         subject="#cgi.server_name# Error"
         server="#request.emailServer#"
         type="HTML">
         <p>
         <a href="#request.errorDomain##request.theFileName#.html">
         See It
         </a>
         </p>
         <p>
         <a href="#request.errorDomain#list.cfm">
         See complete error list
         </a>
         </p>
      </cfmail>
   </cfcase>
   <cfcase value="ONSCREEN">
      <cfoutput>
      #variables.dataDump#
      </cfoutput>
   </cfcase>
</cfswitch>

After this my error_dsp01.cfm page should be displayed but never is. If I 
remove all of the code from my datadump page from the start of the 
cfsavecontent tage to the end then the pretty error page is displayed. Is there 
a problem using cfsavecontent in this page? This is driving my nuts!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218497
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to