From e81d505f30769da362df707b53f5748d6f251bcc Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Sun, 17 Sep 2023 20:14:06 +0200 Subject: [PATCH] print parser error --- cashu/wallet/wallet.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cashu/wallet/wallet.py b/cashu/wallet/wallet.py index 69a40b50..ebd1488f 100644 --- a/cashu/wallet/wallet.py +++ b/cashu/wallet/wallet.py @@ -231,7 +231,11 @@ def raise_on_error(resp: Response) -> None: Raises: Exception: if the response contains an error """ - resp_dict = resp.json() + try: + resp_dict = resp.json() + except Exception: + logger.error(f"Could not parse response from mint: {resp.text}") + raise Exception(f"Could not parse response from mint: {resp.text}") if "detail" in resp_dict: logger.trace(f"Error from mint: {resp_dict}") error_message = f"Mint Error: {resp_dict['detail']}"