parent
dfc3423c83
commit
795384ca2d
4 changed files with 7 additions and 7 deletions
|
@ -59,9 +59,9 @@ class HabiticaDataUpdateCoordinator(DataUpdateCoordinator[HabiticaData]):
|
|||
tasks_response.extend(await self.api.tasks.user.get(type="completedTodos"))
|
||||
except ClientResponseError as error:
|
||||
if error.status == HTTPStatus.TOO_MANY_REQUESTS:
|
||||
_LOGGER.debug("Currently rate limited, skipping update")
|
||||
_LOGGER.debug("Rate limit exceeded, will try again later")
|
||||
return self.data
|
||||
raise UpdateFailed(f"Error communicating with API: {error}") from error
|
||||
raise UpdateFailed(f"Unable to connect to Habitica: {error}") from error
|
||||
|
||||
return HabiticaData(user=user_response, tasks=tasks_response)
|
||||
|
||||
|
|
|
@ -204,10 +204,10 @@
|
|||
"message": "Unable to create new to-do `{name}` for Habitica, please try again"
|
||||
},
|
||||
"setup_rate_limit_exception": {
|
||||
"message": "Currently rate limited, try again later"
|
||||
"message": "Rate limit exceeded, try again later"
|
||||
},
|
||||
"service_call_unallowed": {
|
||||
"message": "Unable to carry out this action, because the required conditions are not met"
|
||||
"message": "Unable to complete action, the required conditions are not met"
|
||||
},
|
||||
"service_call_exception": {
|
||||
"message": "Unable to connect to Habitica, try again later"
|
||||
|
|
|
@ -207,7 +207,7 @@ async def test_button_press(
|
|||
[
|
||||
(
|
||||
HTTPStatus.TOO_MANY_REQUESTS,
|
||||
"Currently rate limited",
|
||||
"Rate limit exceeded, try again later",
|
||||
ServiceValidationError,
|
||||
),
|
||||
(
|
||||
|
@ -217,7 +217,7 @@ async def test_button_press(
|
|||
),
|
||||
(
|
||||
HTTPStatus.UNAUTHORIZED,
|
||||
"Unable to carry out this action",
|
||||
"Unable to complete action, the required conditions are not met",
|
||||
ServiceValidationError,
|
||||
),
|
||||
],
|
||||
|
|
|
@ -165,4 +165,4 @@ async def test_coordinator_rate_limited(
|
|||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert "Currently rate limited, skipping update" in caplog.text
|
||||
assert "Rate limit exceeded, will try again later" in caplog.text
|
||||
|
|
Loading…
Add table
Reference in a new issue