Mercurial > code > home > repos > homeauto
view lib/cycloneerr.py @ 1154:5da3a85b59e4
more robust about not accumulating old stmts
Ignore-this: ee8618c8341d028fd7bd3596cd16a43d
darcs-hash:447cf599c2a1633481bc68fc3bc2fa5b8352fbf5
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Mon, 16 Apr 2018 22:16:15 -0700 |
parents | bebb8f7c5a3e |
children | 053fd552b675 |
line wrap: on
line source
import httplib, cgi class PrettyErrorHandler(object): """ mix-in to improve cyclone.web.RequestHandler """ def get_error_html(self, status_code, **kwargs): try: tb = kwargs['exception'].getTraceback() except AttributeError: tb = "" return "<html><title>%(code)d: %(message)s</title>" \ "<body>%(code)d: %(message)s<pre>%(tb)s</pre></body></html>" % { "code": status_code, "message": httplib.responses[status_code], "tb" : cgi.escape(tb), }