TG2 WebError Traceback per Mail while still handling the exception

25 views
Skip to first unread message

Moritz Schlarb

unread,
May 2, 2012, 9:07:13 AM5/2/12
to turbo...@googlegroups.com
Hello again! ;)

Is there a way to catch an Exception and make WebError send the stacktrace per email (if not in debug mode) and still handle the exception to fail gracefully, by just displaying a flash('An error occured, administrator is alarmed', 'error') to the user?

In the meantime, I just do a
except:
    log.warn('Error in function', exc_info=True)
which at least shows the traceback in the log, but I would rather get a mail ;)

Thanks,
Moritz

Christoph Zwerschke

unread,
May 2, 2012, 11:57:14 AM5/2/12
to turbo...@googlegroups.com
Am 02.05.2012 15:07, schrieb Moritz Schlarb:
> Is there a way to catch an Exception and make WebError send the
> stacktrace per email (if not in debug mode)

If you set "email_to" in your deployment.ini file, this should work.

-- Christoph

Moritz Schlarb

unread,
May 2, 2012, 1:31:50 PM5/2/12
to turbo...@googlegroups.com
But only if the exception is not caught or caught and reraised, which would result in an Error 500 to the user.
My goal would be to send an email and redirect the user to a meaningful error page, or to where he came from, etc.

Cheers,
Moritz

Alessandro Molina

unread,
May 2, 2012, 2:59:19 PM5/2/12
to turbo...@googlegroups.com
The error controller is there for that, you can freely customize the
error page with anything you need.
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/turbogears/-/_mPcKCQLNikJ.
>
> To post to this group, send email to turbo...@googlegroups.com.
> To unsubscribe from this group, send email to
> turbogears+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.
Reply all
Reply to author
Forward
0 new messages