Sure. But I don't know if this was shown somewhere else before.

In you Application.cfm put:
<!--- your IP address range, so your not emailed an error if your the one
throwing it --->
<cfif NOT find("000.000.000.", cgi.remote_HOST)>
 <CFERROR TYPE="EXCEPTION" TEMPLATE="error.cfm">
</cfif>


Now act_error.cfm

<cfset errortable="<TABLE BORDER=1>">
<cfloop collection="#ERROR#" Item="Key">
 <cfset KeyValue=Evaluate('ERROR.'&Key)>
 <cfif isSimpleValue(KeyValue)>
  <cfset errortable=errortable&"<tr><td>#Key#</td><td>">
  <cfif KeyValue NEQ "">
   <cfset errortable=errortable&"#KeyValue#">
  <cfelse>
   <cfset errortable=errortable&"[Not Defined]">
  </cfif>
  <cfset errortable=errortable&"</td></tr>">
 <cfelseif isArray(KeyValue)>
  <cfset errortable=errortable&"<tr><td>#Key#</td><td>">
  <cfloop index="i" from="1" to="#ArrayLen(KeyValue)#">
   <cfset errortable=errortable&"<table border=0><tr><td align=left
colspan=2>[#i#]</td></tr>">
   <cfloop collection="#KeyValue[i]#" item="Key2">
    <cfset
errortable=errortable&"<tr><td>#key2#</td><td>#Evaluate('KeyValue[i].' &
Key2)#</td></tr>">
   </cfloop>
   <cfset errortable=errortable&"</table>">
  </cfloop>
  <cfset errortable=errortable&"</td></tr>">
 </cfif>
</cfloop>
<cfset errortable=errortable&"</table>">

<cf_DumpVariables StringName="Dump">

<CFSETTING ENABLECFOUTPUTONLY="No">

<HTML>
<HEAD>
 <TITLE>Oops! We've found an error</TITLE>
</HEAD>

<BODY leftmargin="0" topmargin="0" bgcolor="#ffffff">

<cfinclude template="#request.webroot#/dsp_header.cfm">

<p>
<table>
<tr>
 <td><b>An error has occurred and has been sent to our technical staff.</b>
<p>
<b>Use your browser's "Back" button to return to the previous page, or go to
the <a href="http://www.yoursite.com">home page</a>.</b></td>
</tr>
</table>



<cfinclude template="#request.webroot#/dsp_footer.cfm">
</BODY>
</HTML>

<CFLOOP LIST="[EMAIL PROTECTED],[EMAIL PROTECTED]" INDEX="email">
<CFMAIL TO="#email#" FROM="[EMAIL PROTECTED]" SUBJECT="eTesters Site
Error" TYPE="HTML">
<h3 align="center">Error Found</h3>
<a
href="http://#CGI.SERVER_NAME#/tools/tasks/index.cfm?fuseaction=taskdetail&t
askid=<cfif isDefined('NewTaskID')>#NewTaskID#<cfelseif
isDefined('qryFindTicket.TaskID')>#qryFindticket.TaskID#</cfif>">Click
Here</a> to go to the task associated with this error.
<BR>
<BR>
#errortable#

<BR>
<h4 align="center">Below are all the variables at the time of the
application error.</h4>
<BR><BR>
#Dump#
</CFMAIL>
</cfloop>
<CFABORT>

end act_error.cfm

This template uses a tag.
here's the code for it.

DumpVariables.cfm

<CFSET SCOPEVARLIST =
"APPLICATION,REQUEST,ATTRIBUTES,CLIENT,SESSION,COOKIE,FORM,URL,CGI">
<CFSET
SERVERVARLIST="Server.ColdFusion.ProductLevel,Server.ColdFusion.ProductName,
Server.ColdFusion.ProductVersion,Server.ColdFusion.SerialNumber,Server.ColdF
usion.SupportedLocales,Server.OS.AdditionalInformation,Server.OS.BuildNumber
,Server.OS.Name,Server.OS.Version">

<CFOUTPUT>
 <CFSET TABLEOUTPUT = "<table border=0 style=font-size:12;font-family:
arial>">

 <CFLOOP LIST="#ScopeVarList#" INDEX="SCOPE">
  <CFIF SCOPE IS "CLIENT" AND ISDEFINED("Client.LastVisit")>
   <CFSET TABLEOUTPUT=TABLEOUTPUT&"<tr><TD COLSPAN=2><HR><B>CLIENT
VARIABLES</B><HR></TD></TR>">
   <CFLOOP LIST="#ListSort(GetClientVariablesList(),"TEXT")#"
INDEX="CurKey">
    <CFSET TABLEOUTPUT=TABLEOUTPUT&"<TR><TD
VALIGN=TOP>"&"#CurKey#"&"</TD><TD><B>"><CFIF
ISDEFINED('CLIENT.#CURKEY#')><CFSET
TABLEOUTPUT=TABLEOUTPUT&"#Evaluate('client.#CurKey#')#"><CFELSE><CFSET
TABLEOUTPUT=TABLEOUTPUT&"[NOT DEFINED]"></CFIF>
    <CFSET TABLEOUTPUT=TABLEOUTPUT&"</b></TD></TR>">
   </CFLOOP>
   <CFSET TABLEOUTPUT=TABLEOUTPUT&"<TR><TD>HitCount</TD><TD><B>">
   <CFIF ISDEFINED('CLIENT.HITCOUNT')>
    <CFSET TABLEOUTPUT=TABLEOUTPUT&"#Client.HitCount#">
   <CFELSE>
    <CFSET TABLEOUTPUT=TABLEOUTPUT&"[NOT DEFINED]">
   </CFIF>
   <CFSET TABLEOUTPUT=TABLEOUTPUT&"</b></TD></TR>">
   <CFSET TABLEOUTPUT=TABLEOUTPUT&"<TR><TD>LastVisit</TD><TD><B>">
   <CFIF ISDEFINED('CLIENT.LASTVISIT')>
    <CFSET TABLEOUTPUT=TABLEOUTPUT&"#Client.LastVisit#">
   <CFELSE>
    <CFSET TABLEOUTPUT=TABLEOUTPUT&"[NOT DEFINED]">
   </CFIF>
   <CFSET TABLEOUTPUT=TABLEOUTPUT&"</b></TD></TR>">
  <CFELSE>
   <CFSET TABLEOUTPUT=TABLEOUTPUT&"<tr><TD COLSPAN=2><HR><B>"&"#SCOPE#"&"
VARIABLES</B><HR></TD></TR>">
   <CFLOOP COLLECTION="#evaluate(scope)#" ITEM="VarName">
    <CFSET MYVAR=EVALUATE("#scope#.#VarName#")>
    <CFSET TABLEOUTPUT=TABLEOUTPUT&"<tr><TD
VALIGN=TOP>"&"#VarName#"&"</TD>">
    <CFIF ISQUERY(MYVAR)>
     <CFSET TABLEOUTPUT=TABLEOUTPUT&"<td><B>Complex Variable:
Query</B></TD></TR>">
    <CFELSEIF ISSTRUCT(MYVAR)>
     <CFSET TABLEOUTPUT=TABLEOUTPUT&"<td><B>Complex Variable:
Structure</B></TD></TR>">
    <CFELSE>
     <CFSET
TABLEOUTPUT=TABLEOUTPUT&"<td><B>"&"#HTMLEditFormat(Evaluate('#scope#.#VarNam
e#'))#"&"</B></TD></TR>">
    </CFIF>
   </CFLOOP>
  </CFIF>
 </CFLOOP>
  <CFSET TABLEOUTPUT=TABLEOUTPUT&"<tr><TD COLSPAN=2><HR><B>SERVER
VARIABLES</B><HR></TD></TR>">
 <CFLOOP LIST="#ServerVarList#" INDEX="CurKey">
  <CFSET TABLEOUTPUT=TABLEOUTPUT&"<TR><TD VALIGN=TOP>"&"#CurKey#"&"</TD><TD
VALIGN=TOP><B>">
  <CFIF ISDEFINED('#CURKEY#')>
   <CFSET TABLEOUTPUT=TABLEOUTPUT&"#Evaluate(CurKey)#">
  <CFELSE>
   <CFSET TABLEOUTPUT=TABLEOUTPUT&"[NOT DEFINED]">
  </CFIF>
  <CFSET TABLEOUTPUT=TABLEOUTPUT&"</b></TD></TR>">
 </CFLOOP>
 <CFSET TABLEOUTPUT=TABLEOUTPUT&"</table>">
</CFOUTPUT>
<CFSET "caller.#attributes.StringName#"=TABLEOUTPUT>










----- Original Message -----
From: "Jim Priest" <[EMAIL PROTECTED]>
To: "Fusebox" <[EMAIL PROTECTED]>
Sent: Monday, January 15, 2001 9:53 AM
Subject: act_error.cfm???


> I'm looking for an 'act_error.cfm/dsp_error.cfm' which I found
> mentioned in the list archives... trying to wrap some of my index.cfm
> files with some error checking and am wondering how others are
> handling this problem - looks like using cftry/cfcatch is the way to
> go... just looking for some example code.
>
> Or has anyone come up with anything better?
>
> thanks
> jim
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to