diff options
Diffstat (limited to 'talermerchantdemos/httpcommon/__init__.py')
-rw-r--r-- | talermerchantdemos/httpcommon/__init__.py | 8 |
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( |