Sounds good.  I'll try the <CFINCLUDE> route...should work better.

Thanks, Mosh.

Rick

-----Original Message-----
From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 3:18 PM
To: CF-Talk
Subject: RE: cferror


Rick:

You don't need the try/catch blocks for setting up the CFERROR tags.

You might consider setting up your error templates like the following:

        <!--- exception_error.cfm --->
                <!--- Use CFMAIL to send diagnostic/error data to admin --->
                <CFINCLUDE TEMPLATE="request_error.cfm">

        <!--- request_error.cfm --->
                <!--- Display error message to user --->

This way, there's only a single displayable error screen to maintain.

And just to clarify, if you use 2 CFERROR tags, one with TYPE="Exception"
and the other with TYPE="Request", the TYPE="Exception" should catch every
uncaught error except those that are generated by the error handler defined
in the TYPE="Exception" CFERROR tag.  Those are caught by the TYPE="Request"
handler.

BTW, the above is true only if the EXCEPTION attribute is not specified or
is set to "All."  If you specify a distinct exception, then only exceptions
of that type will be handled by the specified error handler.  However,
there's no reason why you can specify multiple CFERROR TYPE="Exception" tags
as in:

        <CFERROR TYPE="Request" TEMPLATE="request_error.cfm">
        <CFERROR TYPE="Exception" EXCEPTION="Database" TEMPLATE="db_exception.cfm">
        <CFERROR TYPE="Exception" EXCEPTION="Application"
TEMPLATE="app_exception.cfm">

I don't know what would happen though if you did the above and also included
an EXCEPTION="All".  Would it catch everything, ignoring the other tags, or
would it catch everything not specified in the other tags.  Order might
matter in this case (as it does when declaring CFCATCH blocks).  Dunno... if
I have some time tonight, I'll try to remember to test it out.

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 625-9191
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/


> -----Original Message-----
> From: Rick Faircloth [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 18, 2002 12:38 PM
> To: CF-Talk
> Subject: RE: cferror
>
>
> So, it would be best to have the code to send an email to the admin
> and the code to display the error message to the user on the page that
> is called when the Exception error is triggered...
>
> Then, if the Exception trigger errors, the regular Request error page will
> kick in and display the normal error message to the user without the
> admin email being sent, since CF Tags can be used with Request
> error pages.
>
> Am I getting this?
>
> Also, I've got the code for the error page just below the <CFAPPLICATION>
> tag
> like this:
>
> <CFERROR Type="exception" Template="error_admin.cfm" EXCEPTION="Any"
> mailto="[EMAIL PROTECTED]">
>
> <CFERROR Type="request" Template="error_page.cfm"
> mailto="[EMAIL PROTECTED]">
>
> Then, the rest of the page's code.  Do I need any kind of Catch/Try to
> bypass
> the Request Error code above if the Exception Error code is processed?
> I would guess not, since when the Exception Error code is processed,
> everything
> comes to a halt, anyway...right?
>
> Thanks for your insights.
>
> Rick
>
>
> -----Original Message-----
> From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 18, 2002 12:18 PM
> To: CF-Talk
> Subject: RE: cferror
>
>
> Even though you've implemented CFERROR to catch EXCEPTIONS, you
> should still
> have another CFERROR with REQUEST in case your EXCEPTION handling
> page ever
> generates an error.  If it does, it will be caught by the REQUEST CFERROR.
>
> --
> Mosh Teitelbaum
> evoch, LLC
> Tel: (301) 625-9191
> Fax: (301) 933-3651
> Email: [EMAIL PROTECTED]
> WWW: http://www.evoch.com/
>
>
> > -----Original Message-----
> > From: Rick Faircloth [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, December 18, 2002 11:42 AM
> > To: CF-Talk
> > Subject: RE: cferror
> >
> >
> > Hi, Tim.
> >
> > I implemented your approach below and it works well,
> > except that when the request type error occurs,
> > I do get the email sent to the admin, but the only thing
> > that shows up in the browser is a blank screen.
> >
> > If I add your error_page.cfm code to the error_admin.cfm page
> > then the admin email is sent, then the error message to the user
> > is displayed.
> >
> > Why do we need two pages?  (I assume that exception error code,
> > being set to "any" will catch every type of error that occurs and
> > therefore,
> > the error_admin.cfm page will always be executed?)
> >
> > Thanks,
> >
> > Rick
> >
> >
> > -----Original Message-----
> > From: Tim Laureska [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, December 18, 2002 8:54 AM
> > To: CF-Talk
> > Subject: RE: cferror
> >
> >
> > First, a thanks to those who replied to my initial question about
> > CFERROR.... I thought it might be useful to share what I finally came up
> > with.... Using Scott Brady's initial suggestion for using two error
> > template references in the application.cfm file (exception and request).
> > The templates are as follows... these seem to work fine in testing and
> > may be pretty basic, but I learned a fair amount from the exercise
> >
> > APPLICATION.CFM file:
> >
> > <!--- code for sending error message to web developer/site admin---->
> > <cferror type="exception" template="error_admin.cfm" EXCEPTION="Any"
> > mailto="[EMAIL PROTECTED]">
> >
> > <!--- code for person viewing web page--->
> > <cferror type="request" template="error_page.cfm"
> > mailto="[EMAIL PROTECTED]">
> >
> >
> > ERROR_ADMIN.cfm: (file to send message to web page developer/admin)
> >
> > <cfmail from="[EMAIL PROTECTED]" subject="Web Site Error Report"
> > to="[EMAIL PROTECTED]" type="html">
> > Error Date/Time: #DateFormat(Now())#  at #TimeFormat(Now(),"h:m tt")#<p>
> > Viewers Browser: #http_user_agent#<p>
> > Page error was generated: #error.template#<p>
> > URL Query string of Client's request: #error.QueryString#<p>
> > #error.diagnostics#
> > </cfmail>
> >
> > ERROR_PAGE.CFM (excerpt of page that viewer sees)
> >
> > We have logged the following information that will help us identify and
> > correct the problem:
> >    <UL>
> >     <LI>Error occurred at <B>#ERROR.Datetime#</B>
> >     <LI>Your IP address is <B>#ERROR.RemoteAddress#</B>
> >     <LI>Your browser is <B>#ERROR.Browser#</B>
> >     <LI>You were trying to process
> > <B>#ERROR.Template#?#ERROR.QueryString#</B>
> >    </UL>
> >    If you can provide us with any additional information that would help
> > us fix this problem, please send E-Mail to: <A
> > HREF="mailto:#ERROR.MailTo#";>#ERROR.MailTo#</A>.
> >
> >
> > Tim Laureska
> >
> >
> > -----Original Message-----
> > From: Chris Norloff [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, December 18, 2002 8:26 AM
> > To: CF-Talk
> > Subject: RE: cferror
> >
> > Here's my notes on cferror types (CF 4.5 SP2, Solaris, Oracle 8i):
> >
> > Chris Norloff
> >
> >
> > type="expression"
> >     - catches bad expression like "select * from m_job_summary where
> > job_id=#doesnt_exist#"
> >
> > type="database"
> >     - catches bad SQL like "select * from m_job_summary GROUP ORDER
> > BY"
> >     - catches invalid column like "select * from m_job_summary where
> > doesnt_exist=10"
> >
> > type="missinginclude"
> >     - catches missing cfincluded files
> >     - catches missing cfmodule files.
> >
> > type="lock"
> >     - catches problem with lock, such as timing out while waiting to
> > get exclusive access.
> >
> > type="any"
> >     Catches things not caught by a previous cfcatch statement.
> >     Example:
> >     - timeout error.  Sometimes timeout error has type
> > COM.ALLAIRE.COLDFUSION.REQUEST.TIMEOUT.  Sometimes type is UNKNOWN and
> > the message is Request timed out.
> >
> >
> >
> >
> >
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to