This commit is contained in:
@@ -44,7 +44,7 @@ class UpApi:
|
||||
if response.status >= 400:
|
||||
raise UpApiError(f"Up API request failed ({response.status})")
|
||||
return (await response.json())["data"]
|
||||
except aiohttp.ClientError as err:
|
||||
except (aiohttp.ClientError, TimeoutError) as err:
|
||||
raise UpApiError("Unable to reach the Up API") from err
|
||||
|
||||
async def _list(
|
||||
@@ -70,5 +70,5 @@ class UpApi:
|
||||
if response.status >= 400:
|
||||
raise UpApiError(f"Up API request failed ({response.status})")
|
||||
return await response.json()
|
||||
except aiohttp.ClientError as err:
|
||||
except (aiohttp.ClientError, TimeoutError) as err:
|
||||
raise UpApiError("Unable to reach the Up API") from err
|
||||
|
||||
@@ -59,7 +59,10 @@ class UpCoordinator(DataUpdateCoordinator[dict[str, dict[str, Any]]]):
|
||||
for tx_id, saved in list(self._seen.items()):
|
||||
if saved["status"] != "HELD":
|
||||
continue
|
||||
current = await self.api.transaction(tx_id)
|
||||
try:
|
||||
current = await self.api.transaction(tx_id)
|
||||
except UpApiError as err:
|
||||
raise UpdateFailed(str(err)) from err
|
||||
if current is None:
|
||||
# A held item that no longer exists was deleted by Up.
|
||||
payload = dict(saved["event"])
|
||||
|
||||
@@ -21,7 +21,7 @@ def transaction_event(transaction: dict[str, Any], event_type: str) -> dict[str,
|
||||
"status": attrs["status"].lower(),
|
||||
"account_id": account.get("id"),
|
||||
"amount": money["value"],
|
||||
"currency": money["currencyCode"],
|
||||
"currency": "$",
|
||||
"description": attrs.get("description", ""),
|
||||
"created_at": attrs.get("createdAt"),
|
||||
"raw_text": attrs.get("rawText"),
|
||||
|
||||
Reference in New Issue
Block a user