Throw exception from SDK API

This commit is contained in:
Daniel Krol 2022-06-14 10:58:45 -04:00
parent ad1864e431
commit 18af5e65de

View file

@ -96,11 +96,15 @@ class WalletSync():
response = requests.get(cls.WALLET_URL, params=params)
# TODO check response version on client side now
if response.status_code == 404:
print ('Wallet not found')
# "No wallet" is not an error, so no exception raised
return None, None
if response.status_code != 200:
print ('Error', response.status_code)
print (response.content)
return None, None
raise Exception("Unexpected status code")
wallet_state = WalletState(
encrypted_wallet=response.json()['encryptedWallet'],
@ -133,7 +137,7 @@ class WalletSync():
else:
print ('Error', response.status_code)
print (response.content)
return None, None, None
raise Exception("Unexpected status code")
wallet_state = WalletState(
encrypted_wallet=response.json()['encryptedWallet'],