mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Merge pull request #5530 from cool-RR/patch-1
Fix exception causes in handlers.py
This commit is contained in:
commit
db46c594bb
@ -452,7 +452,7 @@ class IPythonHandler(AuthenticatedHandler):
|
||||
msg = "Blocking Cross Origin request from {}.".format(referer)
|
||||
else:
|
||||
msg = "Blocking request from unknown origin"
|
||||
raise web.HTTPError(403, msg)
|
||||
raise web.HTTPError(403, msg) from e
|
||||
else:
|
||||
raise
|
||||
|
||||
@ -542,10 +542,10 @@ class IPythonHandler(AuthenticatedHandler):
|
||||
body = self.request.body.strip().decode(u'utf-8')
|
||||
try:
|
||||
model = json.loads(body)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
self.log.debug("Bad JSON: %r", body)
|
||||
self.log.error("Couldn't parse JSON", exc_info=True)
|
||||
raise web.HTTPError(400, u'Invalid JSON in body of request')
|
||||
raise web.HTTPError(400, u'Invalid JSON in body of request') from e
|
||||
return model
|
||||
|
||||
def write_error(self, status_code, **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user