mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2024-11-20 02:28:10 +01:00
fix: crash when a currency pair is unavailable
This commit is contained in:
parent
c4a63e0f2e
commit
fa1f6e5038
@ -250,7 +250,13 @@ async def btc_price(currency: str) -> float:
|
||||
data = r.json()
|
||||
rate = float(provider.getter(data, replacements))
|
||||
await send_channel.put(rate)
|
||||
except (httpx.ConnectTimeout, httpx.ConnectError, httpx.ReadTimeout):
|
||||
except (
|
||||
TypeError, # CoinMate returns HTTPStatus 200 but no data when a currency pair is not found
|
||||
httpx.ConnectTimeout,
|
||||
httpx.ConnectError,
|
||||
httpx.ReadTimeout,
|
||||
httpx.HTTPStatusError, # Some providers throw a 404 when a currency pair is not found
|
||||
):
|
||||
await send_channel.put(None)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user