mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-18 11:55:46 +08:00
Merge pull request #2958 from kevin-bates/fix-2957-add-reason-to-json-errors
Add 'reason' field to JSON error responses
This commit is contained in:
commit
9a5c2c06ad
@ -486,8 +486,10 @@ class APIHandler(IPythonHandler):
|
||||
e = exc_info[1]
|
||||
if isinstance(e, HTTPError):
|
||||
reply['message'] = e.log_message or message
|
||||
reply['reason'] = e.reason
|
||||
else:
|
||||
reply['message'] = 'Unhandled error'
|
||||
reply['reason'] = None
|
||||
reply['traceback'] = ''.join(traceback.format_exception(*exc_info))
|
||||
self.log.warning(reply['message'])
|
||||
self.finish(json.dumps(reply))
|
||||
|
Loading…
Reference in New Issue
Block a user