Skip to content

Commit db46c59

Browse files
authored
Merge pull request #5530 from cool-RR/patch-1
Fix exception causes in handlers.py
2 parents 2a21e2a + 54e58be commit db46c59

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

notebook/base/handlers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def check_xsrf_cookie(self):
452452
msg = "Blocking Cross Origin request from {}.".format(referer)
453453
else:
454454
msg = "Blocking request from unknown origin"
455-
raise web.HTTPError(403, msg)
455+
raise web.HTTPError(403, msg) from e
456456
else:
457457
raise
458458

@@ -542,10 +542,10 @@ def get_json_body(self):
542542
body = self.request.body.strip().decode(u'utf-8')
543543
try:
544544
model = json.loads(body)
545-
except Exception:
545+
except Exception as e:
546546
self.log.debug("Bad JSON: %r", body)
547547
self.log.error("Couldn't parse JSON", exc_info=True)
548-
raise web.HTTPError(400, u'Invalid JSON in body of request')
548+
raise web.HTTPError(400, u'Invalid JSON in body of request') from e
549549
return model
550550

551551
def write_error(self, status_code, **kwargs):

0 commit comments

Comments
 (0)