mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add exception translations for IMGW-PIB integration (#140936)
Add exception translations
This commit is contained in:
parent
6211e378c3
commit
4a5567806b
@ -38,7 +38,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: ImgwPibConfigEntry) -> b
|
|||||||
hydrological_details=False,
|
hydrological_details=False,
|
||||||
)
|
)
|
||||||
except (ClientError, TimeoutError, ApiError) as err:
|
except (ClientError, TimeoutError, ApiError) as err:
|
||||||
raise ConfigEntryNotReady from err
|
raise ConfigEntryNotReady(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="cannot_connect",
|
||||||
|
translation_placeholders={
|
||||||
|
"entry": entry.title,
|
||||||
|
"error": repr(err),
|
||||||
|
},
|
||||||
|
) from err
|
||||||
|
|
||||||
coordinator = ImgwPibDataUpdateCoordinator(hass, entry, imgwpib, station_id)
|
coordinator = ImgwPibDataUpdateCoordinator(hass, entry, imgwpib, station_id)
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
@ -63,4 +63,11 @@ class ImgwPibDataUpdateCoordinator(DataUpdateCoordinator[HydrologicalData]):
|
|||||||
try:
|
try:
|
||||||
return await self.imgwpib.get_hydrological_data()
|
return await self.imgwpib.get_hydrological_data()
|
||||||
except ApiError as err:
|
except ApiError as err:
|
||||||
raise UpdateFailed(err) from err
|
raise UpdateFailed(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="update_error",
|
||||||
|
translation_placeholders={
|
||||||
|
"entry": self.config_entry.title,
|
||||||
|
"error": repr(err),
|
||||||
|
},
|
||||||
|
) from err
|
||||||
|
@ -25,5 +25,13 @@
|
|||||||
"name": "Water temperature"
|
"name": "Water temperature"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"exceptions": {
|
||||||
|
"cannot_connect": {
|
||||||
|
"message": "An error occurred while connecting to the IMGW-PIB API for {entry}: {error}"
|
||||||
|
},
|
||||||
|
"update_error": {
|
||||||
|
"message": "An error occurred while retrieving data from the IMGW-PIB API for {entry}: {error}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user