[Tutor] using sys.excepthook to handled unhandled exceptions

Tony Cappellini cappy2112 at gmail.com
Wed Aug 27 19:00:30 CEST 2008


The original authors left asserts in many places and I don't want the people
using the code to see the ugly tracebacks.
 want to add an unhandled exception handler to a large framework that I'm
maintaining, to make the applications behave better,

Users of a program shouldn't need to know anything about the language in
order to have an idea of what caused the error.

With that in mind, I thought I would add a handler which logs the tracebacks
to a file, display a 1-line message about the error on the screen, so the
user has some
idea of what happened, along with a simple message like this

"An unhandled exception has occured. This program will terminate. Please
email the "ErrorReport.txt" file to the developers"

I would like to hear from "people who have already assigned their own
function to sys.excepthook" as to how they approached this problem, and what
issues they encountered, if any.


Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080827/780d3dda/attachment.htm>


More information about the Tutor mailing list