diff options
author | Colin Watson <cjwatson@debian.org> | 2023-12-17 15:38:50 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2023-12-17 15:38:50 +0000 |
commit | 56d126d1bea64081fe40a2a3f8fbb1c82267c0c6 (patch) | |
tree | d79abcee39136d6a7583d22f47b8eac88277ca7c /macaroonbakery/httpbakery/_client.py | |
parent | e988151f336cac8970d6904a76bf53bccb237920 (diff) |
New upstream version 1.3.4
Diffstat (limited to 'macaroonbakery/httpbakery/_client.py')
-rw-r--r-- | macaroonbakery/httpbakery/_client.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/macaroonbakery/httpbakery/_client.py b/macaroonbakery/httpbakery/_client.py index 326c33d..230531d 100644 --- a/macaroonbakery/httpbakery/_client.py +++ b/macaroonbakery/httpbakery/_client.py @@ -131,7 +131,13 @@ class Client: # TODO Fabrice what is the other http response possible ?? if resp.status_code == 200: return bakery.Macaroon.from_dict(resp.json().get('Macaroon')) - cause = Error.from_dict(resp.json()) + # A 5xx error might not return json. + try: + cause = Error.from_dict(resp.json()) + except ValueError: + raise DischargeError( + 'unexpected response: [{}] {!r}'.format(resp.status_code, resp.content) + ) if cause.code != ERR_INTERACTION_REQUIRED: raise DischargeError(cause.message) if cause.info is None: |