I tried to use Simon's exception handling first but gave up because it
gives no traceback which is crucial for a developer.

I use the following instead:

def cp_on_http_error(self, status, message):
    from cherrypy import _cputil
    _cputil._cp_on_http_error(status, message)

    if status == 404:
        return # do no extra processing on 404 errors

    log.exception('CherryPy %s error (%s)', status, message)

    import traceback, StringIO
    buf = StringIO.StringIO()
    traceback.print_exc(file=buf)
    url = "%s %s" % (cherrypy.request.method,
                cherrypy.request.path)
    send_exception_to_developer(status, url, buf.getvalue())

    # Return customized page
    ...

# Hook it in for production only
if tg.config.get('server.environment') == 'production':
    Root._cp_on_http_error = cp_on_http_error

# function send_exception_to_developer
# simply formats mail message nicely and sends via SMTP

HTH,
Max.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to