You can generate a custom error template that should handle that for you.
Here is the code I am using, the first page traps the errors and the second
page displays the error along with emailing the error to the appropriate
people.  If you use the 'Help' section of Studio and look up 'Generating
Custom Error Messages' you should get the low down on what I'm posting below
as well as other information to customize to your needs.

In the Application.cfm I have the following section of code that applies:
<cfset tempPath = #GetDirectoryFromPath(cgi.cf_template_path)#>
<cfif (cgi.cf_template_path IS NOT "#tempPath#error_request.cfm") AND
(cgi.cf_template_path IS NOT "#tempPath#error_show.cfm")>
        <cferror type="REQUEST" template="error_request.cfm">
</cfif>


In the error_request.cfm:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
        <head>
                <title>Error Action Page</title>
        </head>
        <body onload="document.errorsfound.submit()">
                <div style="visibility:hidden;display:none;">
                        <form action="error_show.cfm" method="post"
name="errorsfound">
                                <input type="hidden" name="DateTime"
value="#Error.DateTime#">
                                <input type="hidden" name="Browser"
value="#Error.Browser#">
                                <input type="hidden" name="RemoteAddress"
value="#Error.RemoteAddress#">
                                <input type="hidden" name="HTTPReferer"
value="#Error.HTTPReferer#">
                                <input type="hidden" name="Template"
value="#Error.Template#">
                                <input type="hidden" name="QueryString"
value="#Error.QueryString#">
                                <input type="hidden" name="MailTo"
value="#Error.MailTo#">
                                <textarea cols="50" rows="10"
name="Diagnostics">#Error.Diagnostics#</textarea>
                        </form>
                </div>
        </body>
</html>


In the error_show.cfm:
<!--- whoTo = to: line of email being sent (valid email addresses) --->
<cfparam name="whoTo" type="string" default="">
<!--- whoCC = cc: line of email being sent (valid email addresses) --->
<cfparam name="whoCC" type="string" default="">
<!--- appName = Application Name --->
<cfparam name="appName" type="string" default="Your web site">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
        <title>Application Error Encountered</title>
</head>
<body>
<!--- Display Custom Error Information to User --->
<h2 align="center">Our apologizes, an error has been encountered.</h2>
<p>
<table border="0" cellspacing="0" cellpadding="1" align="center"
style="border:solid 1 black;">
        <tr>
                <td bgcolor="skyblue"><b>The site administrator has been
notified of the error/problem.</b></td>
        </tr>
        <tr>
                <td bgcolor="skyblue">Here is only <u>SOME</u> of the
information that has been submitted to the site administrator.</td>
        </tr>
        <tr bgcolor="#CCEEFF">
                <td>
                        <cfoutput>
                                <ul>
                                        <li>Date and Time: #form.DateTime#
                                        <li>Browser Used: #form.Browser#
                                        <li>Remote Address:
#form.RemoteAddress#
                                        <li>Query String: <cfif
Len(form.QueryString)>#form.QueryString#<cfelse>N/A</cfif>
                                </ul>
                        </cfoutput>
                </td>
        </tr>
</table>
<p>&nbsp;</p>
<!--- send email to owner[s]  and customer(s) based on #whoTo# and #whoCC#
vars --->
<cfmail to="#whoTo#" cc="#whoCC#" from="[EMAIL PROTECTED]"
subject="#appName# - #dateFormat(now())#" type="HTML">
<cfoutput>
        <table border="0" cellspacing="0" cellpadding="1" align="center"
style="border:solid 1 black;">
                <tr bgcolor="skyblue">
                        <td colspan="2" align="center">Error information
from the <b>#appName#</b> application</td>
                </tr>
                <tr bgcolor="CCEEFF">
                        <td align="left" valign="top" nowrap><b>Date and
Time:</b></td><td align="left" valign="top">#form.DateTime#</td>
                </tr>
                <tr bgcolor="CCEEFF">
                        <td align="left" valign="top" nowrap><b>Remote
Address:</b></td><td align="left" valign="top">#form.RemoteAddress#</td>
                </tr>
                <tr bgcolor="CCEEFF">
                        <td align="left" valign="top"
nowrap><b>Server:</b></td><td align="left"
valign="top">#cgi.server_name#</td>
                </tr>
                <tr bgcolor="CCEEFF">
                        <td align="left" valign="top" nowrap><b>Browser
Used:</b></td><td align="left" valign="top">#form.Browser#</td>
                </tr>
                <tr bgcolor="CCEEFF">
                        <td align="left" valign="top" nowrap><b>Query
String:</b></td><td align="left" valign="top"><cfif
Len(form.QueryString)>#form.QueryString#<cfelse>Not Available</cfif></td>
                </tr>
                <tr bgcolor="CCEEFF">
                        <td align="left" valign="top" nowrap><b>HTTP
Referer:</b></td><td align="left" valign="top"><cfif
Len(form.HTTPReferer)>#form.HTTPReferer#<cfelse>Not Available</cfif></td>
                </tr>
                <tr bgcolor="CCEEFF">
                        <td align="left" valign="top"
nowrap><b>Template:</b></td><td align="left"
valign="top">#form.Template#</td>
                </tr>
                <tr bgcolor="CCEEFF">
                        <td colspan="2"><hr></td>
                </tr>
                <tr bgcolor="CCEEFF">
                        <td align="left" valign="top"
nowrap><b>Diagnostics:</b></td><td align="left"
valign="top">#form.Diagnostics#</td>
                </tr>
                <tr bgcolor="CCEEFF">
                        <td colspan="2"><hr></td>
                </tr>
                <tr bgcolor="CCEEFF">
                        <th colspan="2">This error WAS NOT sent to the
developers of the web site.  Please ensure you notify them of the
error.</th>
                </tr>
        </table>
</cfoutput>
</cfmail>
</body>
</html>


Hope this helps,



Steven Semrau
SRA International, Inc.
Senior Member, Professional Staff
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Com:  (703) 805-1095
DSN:  (703) 655-1095


-----Original Message-----
From: Percy E Perez [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 17, 2001 2:17 PM
To: CF-Talk
Subject: catching error from cfcontent.


Hello all,

I am trying to trap an error thrown by cfcontent, I wrapped cfcontent with
cftry, but when I generate the error, I do not get my message but rather.

"Please inform the site administrator that this error has occurred (be sure
to include the contents of this page in your message to the administrator)."

which I don't want my users to see.

Any suggestions,
I am running 4.0.1/nt4.0/sp6a.

Thanks

Percy E Perez

<cftry>
        <CFCONTENT TYPE="#v_mime#"
                FILE="#v_file#"
        >
        <cfcatch type="any">
                Blah....
        </cfcatch>
</cftry>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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