Skip to content

Commit

Permalink
Merge pull request #2958 from kevin-bates/fix-2957-add-reason-to-json…
Browse files Browse the repository at this point in the history
…-errors

Add 'reason' field to JSON error responses
  • Loading branch information
takluyver authored Nov 1, 2017
2 parents e7f69cc + ed3b0e4 commit 9a5c2c0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions notebook/base/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,10 @@ def write_error(self, status_code, **kwargs):
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))
Expand Down

0 comments on commit 9a5c2c0

Please sign in to comment.