Here's one way I do it, very simple and does not try to get into specific solutions 
for specific errors:

Surround your entire page in 

<CFTRY></CFTRY>

and, just before the /CFTRY, plug in this:

<CFCATCH TYPE="MissingInclude"><CFINCLUDE TEMPLATE="catch_include.cfm"></CFCATCH>

<CFCATCH TYPE="Database"><CFINCLUDE TEMPLATE="catch_database.cfm"></CFCATCH>

<CFCATCH TYPE="Any"><CFINCLUDE TEMPLATE="catch_any.cfm"></CFCATCH>

These transmit slightly different errmsgs depending on the error type.

Here's catch_any.cfm.  Its set up so if I'm on my dev server it just displays an error 
scrn rather than emailing anything anywhere.  uhoh.cfm, referenced at bottom, is a 
kind/gentle ''Oops'' html page displayed to the unlucky visitor.

A site-wide error handler implemented via Administrator is a better way to do this, 
IMHO.  But you need server admin access to go there.

<CFSET variables.DNOW ="#CreateODBCDateTime(now())#">
<CFIF NOT CompareNoCase(CGI.REMOTE_ADDR,"127.0.0.1")>
        <DIV ALIGN="LEFT">
        <CFOUTPUT>
        <TABLE BORDER="1" BGCOLOR="##FFFF00" ><TR><TD>
        <B>ERROR TYPE:</B> #CFCATCH.type#
        <BR><B>MESSAGE:</B> #CFCATCH.Message#
        <HR><B>DETAIL:</B> #CFCATCH.Detail#
        <B>PAGE:</B> #CGI.PATH_TRANSLATED#
        <BR><B>REFERRER:</B> #CGI.HTTP_REFERER#
        <BR><B>Query String:</B> #CGI.QUERY_STRING#
        <BR><B>REMOTE ADDR:</B> #CGI.REMOTE_ADDR#
        <BR><B>REMOTE HOST:</B> #CGI.REMOTE_HOST#
        <BR><B>REMOTE IDENT:</B> #CGI.REMOTE_IDENT#
        <BR><B>REMOTE USER:</B> #CGI.REMOTE_USER#
        <BR><B>BROWSER:</B> #CGI.HTTP_USER_AGENT#
        
        <P>#variables.DNOW#
        </TD></TR></TABLE>
        </CFOUTPUT>     
        </DIV>
<CFELSE>
        <CFMAIL 
                TO="[EMAIL PROTECTED]" 
                FROM="[EMAIL PROTECTED]" 
                SUBJECT="#CFCATCH.type#" 
                SERVER="mail.their.com"
                TYPE="HTML">
        <B>MESSAGE:</B> #CFCATCH.Message#<HR>
        <B>DETAIL:</B> #CFCATCH.Detail#
        <BR><B>PAGE:</B> #CGI.PATH_TRANSLATED#
        <BR><B>REFERRER:</B> #CGI.HTTP_REFERER#
        <BR><B>Query String:</B> #CGI.QUERY_STRING#
        <HR><B>SERVER:</B> #CGI.SERVER_NAME#
        <BR><B>REMOTE ADDR:</B> #CGI.REMOTE_ADDR#
        <BR><B>REMOTE HOST:</B> #CGI.REMOTE_HOST#
        <BR><B>REMOTE IDENT:</B> #CGI.REMOTE_IDENT#
        <BR><B>REMOTE USER:</B> #CGI.REMOTE_USER#
        <BR><B>BROWSER:</B> #CGI.HTTP_USER_AGENT#
        <P>#variables.DNOW#
        <CFMAILPARAM NAME="Reply-To" VALUE="[EMAIL PROTECTED]">
        <CFMAILPARAM NAME="Message-ID" VALUE="<#CreateUUID()#@mail.lelandwest.com>">
        </CFMAIL>
        <CFLOCATION URL="uhoh.cfm" ADDTOKEN="No">
</CFIF>

---------------------------------------
Matt Robertson    [EMAIL PROTECTED]
MSB Designs, Inc., www.mysecretbase.com
---------------------------------------


---------- Original Message ----------------------------------
from: "Mark Warrick" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
date: Fri, 21 Jun 2002 14:54:07 -0700

I'm building an error-trapping template which I'd like to be automatically
emailed to me.  I've figured out how to use CFERROR to display the problem
to the screen, but how do I go about sending that to me automatically?

There must be something I'm missing here.  Is it perhaps a javascript
technique that automatically posts the contents of a form on the same page?

I'm curious to know how everyone else handles this.

Thanks.

---mark

========================================================
Mark Warrick ([EMAIL PROTECTED])
Founder, Fusioneers.com / CTO, ZapConnect.com
Phone: 714-547-5386 / 714-667-0203 / Efax: 801-730-7289
http://www.warrick.net / http://www.fusioneers.com
http://www.zapconnect.com
ICQ: 125160 AIM: markwarric Yahoo: Serengeti
========================================================



______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to