mirror of
https://github.com/aljazceru/nutshell.git
synced 2026-02-11 03:34:22 +01:00
catch json error (#660)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
from posixpath import join
|
||||
from typing import List, Optional, Tuple, Union
|
||||
|
||||
@@ -106,7 +107,12 @@ class LedgerAPIDeprecated(SupportsHttpxClient, SupportsMintURL):
|
||||
Raises:
|
||||
Exception: if the response contains an error
|
||||
"""
|
||||
resp_dict = resp.json()
|
||||
try:
|
||||
resp_dict = resp.json()
|
||||
except json.JSONDecodeError:
|
||||
# if we can't decode the response, raise for status
|
||||
resp.raise_for_status()
|
||||
return
|
||||
if "detail" in resp_dict:
|
||||
logger.trace(f"Error from mint: {resp_dict}")
|
||||
error_message = f"Mint Error: {resp_dict['detail']}"
|
||||
|
||||
Reference in New Issue
Block a user