Mercurial > code > home > repos > homeauto
view lib/cycloneerr.py @ 280:c192d37b2bc8
lots of logging updates (patch may be imprecise)
Ignore-this: cfe81299fe9a1e2b6b1140e9ec46aaf7
author | drewp@bigasterisk.com |
---|---|
date | Fri, 06 May 2016 17:32:41 -0700 |
parents | be855a111619 |
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), }