summaryrefslogtreecommitdiff
path: root/talermerchantdemos
diff options
context:
space:
mode:
authorms <ms@taler.net>2022-03-31 15:40:01 +0200
committerms <ms@taler.net>2022-03-31 15:40:01 +0200
commit2626ecc64d373dfaccfd2eb365c4744d52689360 (patch)
tree51f8a8fa9eb6d1e0ba33805aa0515906bec8b212 /talermerchantdemos
parentadd77184cba4f046ffaae4a3872c81861de9b15e (diff)
downloadtaler-merchant-demos-2626ecc64d373dfaccfd2eb365c4744d52689360.tar.gz
taler-merchant-demos-2626ecc64d373dfaccfd2eb365c4744d52689360.tar.bz2
taler-merchant-demos-2626ecc64d373dfaccfd2eb365c4744d52689360.zip
error management
Diffstat (limited to 'talermerchantdemos')
-rw-r--r--talermerchantdemos/httpcommon/__init__.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/talermerchantdemos/httpcommon/__init__.py b/talermerchantdemos/httpcommon/__init__.py
index b9d7e35..0584cba 100644
--- a/talermerchantdemos/httpcommon/__init__.py
+++ b/talermerchantdemos/httpcommon/__init__.py
@@ -14,7 +14,7 @@ LOGGER = logging.getLogger(__name__)
class BackendException(Exception):
"""Exception for failed communication with the Taler merchant backend"""
- def __init__(self, message, backend_status=None, backend_json=None):
+ def __init__(self, message, backend_status=None, backend_json={}):
super().__init__(backend_json.get("hint", message))
self.backend_status = backend_status
self.backend_json = backend_json
@@ -41,9 +41,9 @@ def backend_post(backend_url, endpoint, json, auth_token=None):
)
try:
response_json = resp.json()
- except ValueError:
+ except Exception:
raise BackendException(
- message=gettext("Could not parse response from backend"),
+ message=gettext("Could not parse the response from backend"),
backend_status=resp.status_code,
)
if resp.status_code != 200:
@@ -81,7 +81,7 @@ def backend_get(backend_url, endpoint, params, auth_token=None):
)
try:
response_json = resp.json()
- except ValueError:
+ except Exception:
raise BackendException(message=gettext("Could not parse response from backend"))
if resp.status_code != 200:
raise BackendException(