summaryrefslogtreecommitdiff
path: root/talerbank/app/middleware.py
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-08-05 17:52:51 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-08-05 17:52:51 +0530
commit7aa2b2f1c088da52540d55877edd7921cc55ed54 (patch)
treeffb623fdb08d4e5fca8402b538dc8d2afe93ce99 /talerbank/app/middleware.py
parent695b38fbd7e7d2843468b8560f4504416556b65f (diff)
downloadbank-7aa2b2f1c088da52540d55877edd7921cc55ed54.tar.gz
bank-7aa2b2f1c088da52540d55877edd7921cc55ed54.tar.bz2
bank-7aa2b2f1c088da52540d55877edd7921cc55ed54.zip
error handling
Diffstat (limited to 'talerbank/app/middleware.py')
-rw-r--r--talerbank/app/middleware.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/talerbank/app/middleware.py b/talerbank/app/middleware.py
index 093ff20..eeb6a67 100644
--- a/talerbank/app/middleware.py
+++ b/talerbank/app/middleware.py
@@ -95,17 +95,18 @@ class ExceptionMiddleware:
if so. Otherwise, it lets the native handler operate.
"""
LOGGER.error(f"Error: {exception}, while serving {request.get_full_path()}")
+ LOGGER.error(f"Stack trace: {traceback.format_exc()}")
if hasattr(exception, "taler_error_code"):
render_to = self.render.get(request.path)
if not render_to:
return JsonResponse(
- {"ec": exception.taler_error_code, "error": exception.hint},
+ {"code": exception.taler_error_code, "error": exception.hint},
status=exception.http_status_code,
)
set_profile_hint(request, failure=True, success=False, hint=exception.hint)
return redirect(render_to)
else:
- return JsonResponse(dict(hint="unexpected exception", exception=str(exception)), status=500)
+ return JsonResponse(dict(code=5300, hint="unexpected exception", exception=str(exception)), status=500)