commit 49226fbf23403ae1008f042dc3b1afb95aba5006
parent ad12876b0c6b9f1aaaf8eafd6c7765dc2efeba83
Author: Sheng <webmaster0115@gmail.com>
Date: Tue, 28 Aug 2018 21:15:57 +0800
Swallow 500 errors
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/webssh/handler.py b/webssh/handler.py
@@ -74,13 +74,15 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
self.result = dict(id=None, status=None, encoding=None)
def write_error(self, status_code, **kwargs):
- if self.settings.get('serve_traceback') or status_code == 500 or \
- not swallow_http_errors:
+ if not swallow_http_errors:
super(MixinHandler, self).write_error(status_code, **kwargs)
else:
- exc_info = kwargs.get('exc_info')
- if exc_info:
- self._reason = exc_info[1].log_message
+ if status_code == 500:
+ self._reason = 'Internal Server Error'
+ else:
+ exc_info = kwargs.get('exc_info')
+ if exc_info:
+ self._reason = exc_info[1].log_message
self.result.update(status=self._reason)
self.set_status(200)
self.finish(self.result)