Download:
child 224:ce4f062fce9d
parent 222:e02db9d564fb
223:273b56088235
Anton Shestakov <av6@dwimlabs.net>, Wed, 24 Aug 2016 19:46:24 +0800
queue: turn HTTPErrors into JSON responses via BaseHookHandler.write_error()

1 файлов изменено, 6 вставок(+), 0 удалений(-) [+]
hooks-queue.py file | annotate | diff | comparison | revisions
--- a/hooks-queue.py Wed Aug 24 19:37:29 2016 +0800
+++ b/hooks-queue.py Wed Aug 24 19:46:24 2016 +0800
@@ -23,6 +23,12 @@
def rconn(self):
return self.application.rconn
+ def write_error(self, status_code, **kwargs):
+ result = self._reason
+ if 'exc_info' in kwargs:
+ result = getattr(kwargs['exc_info'][1], 'log_message', result)
+ self.finish({'result': result})
+
def parse_json_payload(self):
try:
return json.loads(self.request.body)