Mercurial > code > home > repos > homeauto
view lib/cycloneerr/cycloneerr.py @ 1492:7c7415cfbc02
iot2: WIP still. more messages schema
Ignore-this: ef94336852ff8885df861146fc1b01b
darcs-hash:f5e1ffe61ecff1a7430b58a7504e35dcc809b1f8
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Wed, 29 Jan 2020 01:03:40 -0800 |
parents | c5bd44f90ced |
children | fd94061db75c |
line wrap: on
line source
try: import http.client as httplib except ImportError: import httplib # type: ignore import 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), }