summaryrefslogtreecommitdiff
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
parent695b38fbd7e7d2843468b8560f4504416556b65f (diff)
downloadbank-7aa2b2f1c088da52540d55877edd7921cc55ed54.tar.gz
bank-7aa2b2f1c088da52540d55877edd7921cc55ed54.tar.bz2
bank-7aa2b2f1c088da52540d55877edd7921cc55ed54.zip
error handling
-rw-r--r--talerbank/app/middleware.py5
-rw-r--r--talerbank/app/views.py4
2 files changed, 5 insertions, 4 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)
diff --git a/talerbank/app/views.py b/talerbank/app/views.py
index 0b25c3d..b450fc7 100644
--- a/talerbank/app/views.py
+++ b/talerbank/app/views.py
@@ -1029,7 +1029,7 @@ def api_withdraw_operation(request, withdraw_id):
exchange_user = User.objects.get(username=exchange_account_name)
except User.DoesNotExist:
return JsonResponse(
- dict(error="bank account in payto URI unknown"), status=400
+ dict(code=5110, hint="bank account in payto URI unknown"), status=400
)
exchange_account = exchange_user.bankaccount
selected_reserve_pub = data.get("reserve_pub")
@@ -1052,7 +1052,7 @@ def api_withdraw_operation(request, withdraw_id):
# Confirmation already happened, we still need to transfer funds!
wire_transfer(
op.amount,
- user_account,
+ op.withdraw_account,
op.selected_exchange_account,
op.selected_reserve_pub,
)