Thread: Error handling

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Sydney, AU
    Posts
    37
    Rep Power
    11

    Error handling


    I'm having some troubles with handling errors.
    First off I'm using a content management system for my CFML pages.

    Anyways that shouldn't really matter.
    So in the application.cfm file, I have:
    Code:
    <cferror 
        template="error.cfm"
        mailto="zzz@zzz.com"
        type="Exception"
        exception="ANY"
    >
    My error.cfm file contains:
    Code:
    <CFMAIL server="#mailserver#" from="error@zzz.com" to="#Error.MailTo#" subject="Auto Error Report">
    Error occured in template: #Error.Template#
    At this time: #Error.DateTime#
    The query string was: #Error.QueryString#
    The referring page was: #Error.HTTPReferrer#
    Web browser used: #Error.Browser#
    
    A detailed diagnostic follows:
    #Error.Diagnostics#
    </cfmail>
    
    <cfoutput>
    Sorry, there was an error processing your request for page: #Error.Template##Error.QueryString#
    <p>The error has been brought to our attention and will be fixed as soon as possible.
    <br/>Sorry for any inconvenience caused.</p>
    </cfoutput>
    However, on an error, the page refuses to send me an email
    display the message. Instead it throws out the error. Do any of
    you see anything wrong with this?

    Thanks.
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,243
    Rep Power
    967
    Try just doing this:

    <cferror type="EXCEPTION" template="error.cfm">

    exceptionType is "any" by default, and the mailto doesn't really do anything as far as I know.

    Also is the error.cfm file in the same dir as your application.cfm file? Also, can you test out the error.cfm file on its own...I think CF gets nutty if your error template itself has an error in it, it has no choice but to show the raw error.

    So not too much help, but I can tell you that we are using a similar technique and it works just fine, so it CAN be done!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Sydney, AU
    Posts
    37
    Rep Power
    11
    Thanks kiteless...

    Though I just found out that it was indeed the CMS causing
    the problem because I couldn't put CF tags on the error page.
    There still seems to be more problems. Guess I'll have to figure
    it out myself or get some support from the CMS..

    Thanks anyways.

IMN logo majestic logo threadwatch logo seochat tools logo