diff --git a/notebook/base/handlers.py b/notebook/base/handlers.py index b8d7a3810..743f7bac7 100755 --- a/notebook/base/handlers.py +++ b/notebook/base/handlers.py @@ -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):