Mercurial > code > home > repos > homeauto
view lib/cycloneerr/cycloneerr.py @ 1745:d90cb7c06f15
try to crash if mqtt doesn't connect
author | drewp@bigasterisk.com |
---|---|
date | Thu, 09 Nov 2023 17:21:59 -0800 |
parents | 71e8ab109f5a |
children |
line wrap: on
line source
try: import http.client as httplib except ImportError: import httplib # type: ignore import html 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" : html.escape(tb), }