mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Translate UpdateFailed error in AVM Fritz/BOX Tools (#131466)
translate UpdateFailed error
This commit is contained in:
parent
d790a2d74c
commit
b7e960f0bc
@ -326,7 +326,11 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
|
||||
"call_deflections"
|
||||
] = await self.async_update_call_deflections()
|
||||
except FRITZ_EXCEPTIONS as ex:
|
||||
raise UpdateFailed(ex) from ex
|
||||
raise UpdateFailed(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="update_failed",
|
||||
translation_placeholders={"error": str(ex)},
|
||||
) from ex
|
||||
|
||||
_LOGGER.debug("enity_data: %s", entity_data)
|
||||
return entity_data
|
||||
|
@ -176,6 +176,9 @@
|
||||
},
|
||||
"unable_to_connect": {
|
||||
"message": "Unable to establish a connection"
|
||||
},
|
||||
"update_failed": {
|
||||
"message": "Error while uptaing the data: {error}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ async def test_sensor_setup(
|
||||
|
||||
|
||||
async def test_sensor_update_fail(
|
||||
hass: HomeAssistant, fc_class_mock, fh_class_mock
|
||||
hass: HomeAssistant, caplog: pytest.LogCaptureFixture, fc_class_mock, fh_class_mock
|
||||
) -> None:
|
||||
"""Test failed update of Fritz!Tools sensors."""
|
||||
|
||||
@ -53,10 +53,12 @@ async def test_sensor_update_fail(
|
||||
await hass.config_entries.async_setup(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
fc_class_mock().call_action_side_effect(FritzConnectionException)
|
||||
fc_class_mock().call_action_side_effect(FritzConnectionException("Boom"))
|
||||
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=300))
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
assert "Error while uptaing the data: Boom" in caplog.text
|
||||
|
||||
sensors = hass.states.async_all(SENSOR_DOMAIN)
|
||||
for sensor in sensors:
|
||||
assert sensor.state == STATE_UNAVAILABLE
|
||||
|
Loading…
x
Reference in New Issue
Block a user