Instead of using the try/catch blocks around each query, use a site-wide error catcher 
that you set up in the Application.cfm file:

<cfif (#CGI.SCRIPT_NAME# NEQ "/includes/errorhandler.cfm")>
        <cferror template="/includes/errorhandler.cfm"  type="exception" 
exception="ANY">
</cfif>

The key is to use the type of "exception" and exception="any" (I think this came in to 
either v4.51 or v5).

So if an error is caught, the users is tossed to the errorhandler.cfm page, where you 
display a "Sorry, error occured" or whatever message and you set the following params:

<cfparam name="error.template" default="unknown">
<cfparam name="error.querystring" default="unknown">
<cfparam name="error.remoteaddress" default="unknown">
<cfparam name="error.HTTPreferer" default/index.cfm">
<cfparam name="error.diagnostics" default="unknown">

You can use the error structure (error.[whatever]) to then send mail to an admin 
and/or dump into a database (I do both).

Just make sure to CFPARAM everything that will be called, or you will get an error in 
the error-handler page and you'll be hosed.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to