mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Add error handling to hassio issues (#94951)
This commit is contained in:
parent
1d18fdf7bd
commit
60b78f4648
@ -306,7 +306,11 @@ class SupervisorIssues:
|
||||
|
||||
async def update(self) -> None:
|
||||
"""Update issues from Supervisor resolution center."""
|
||||
data = await self._client.get_resolution_info()
|
||||
try:
|
||||
data = await self._client.get_resolution_info()
|
||||
except HassioAPIError as err:
|
||||
_LOGGER.error("Failed to update supervisor issues: %r", err)
|
||||
return
|
||||
self.unhealthy_reasons = set(data[ATTR_UNHEALTHY])
|
||||
self.unsupported_reasons = set(data[ATTR_UNSUPPORTED])
|
||||
|
||||
|
@ -715,3 +715,21 @@ async def test_supervisor_remove_missing_issue_without_error(
|
||||
msg = await client.receive_json()
|
||||
assert msg["success"]
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
||||
async def test_system_is_not_ready(
|
||||
hass: HomeAssistant,
|
||||
aioclient_mock: AiohttpClientMocker,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Ensure hassio starts despite error."""
|
||||
aioclient_mock.get(
|
||||
"http://127.0.0.1/resolution/info",
|
||||
json={
|
||||
"result": "",
|
||||
"message": "System is not ready with state: setup",
|
||||
},
|
||||
)
|
||||
|
||||
assert await async_setup_component(hass, "hassio", {})
|
||||
assert "Failed to update supervisor issues" in caplog.text
|
||||
|
Loading…
x
Reference in New Issue
Block a user