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']}"