Mercurial > code > home > repos > light9
view lib/cycloneerr.py @ 1173:423941a4b489
show 2014 checkpoint
Ignore-this: 3dc1b1fb5a0ccb189eac5af97fc90c11
author | drewp@bigasterisk.com |
---|---|
date | Sun, 15 Jun 2014 06:18:06 +0000 |
parents | 473db8bebb8f |
children |
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), }