mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Improve exception handling for Vodafone Station (#102761)
* improve exception handling for Vodafone Station * address review comment * apply review comment * better except handling (bump library) * cleanup
This commit is contained in:
parent
af9cae289f
commit
ae9106effd
@ -95,15 +95,19 @@ class VodafoneStationRouter(DataUpdateCoordinator[UpdateCoordinatorDataType]):
|
|||||||
"""Update router data."""
|
"""Update router data."""
|
||||||
_LOGGER.debug("Polling Vodafone Station host: %s", self._host)
|
_LOGGER.debug("Polling Vodafone Station host: %s", self._host)
|
||||||
try:
|
try:
|
||||||
logged = await self.api.login()
|
try:
|
||||||
except exceptions.CannotConnect as err:
|
await self.api.login()
|
||||||
_LOGGER.warning("Connection error for %s", self._host)
|
except exceptions.CannotAuthenticate as err:
|
||||||
raise UpdateFailed(f"Error fetching data: {repr(err)}") from err
|
raise ConfigEntryAuthFailed from err
|
||||||
except exceptions.CannotAuthenticate as err:
|
except (
|
||||||
raise ConfigEntryAuthFailed from err
|
exceptions.CannotConnect,
|
||||||
|
exceptions.AlreadyLogged,
|
||||||
if not logged:
|
exceptions.GenericLoginError,
|
||||||
raise ConfigEntryAuthFailed
|
) as err:
|
||||||
|
raise UpdateFailed(f"Error fetching data: {repr(err)}") from err
|
||||||
|
except (ConfigEntryAuthFailed, UpdateFailed):
|
||||||
|
await self.api.close()
|
||||||
|
raise
|
||||||
|
|
||||||
utc_point_in_time = dt_util.utcnow()
|
utc_point_in_time = dt_util.utcnow()
|
||||||
data_devices = {
|
data_devices = {
|
||||||
|
@ -6,5 +6,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/vodafone_station",
|
"documentation": "https://www.home-assistant.io/integrations/vodafone_station",
|
||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
"loggers": ["aiovodafone"],
|
"loggers": ["aiovodafone"],
|
||||||
"requirements": ["aiovodafone==0.4.1"]
|
"requirements": ["aiovodafone==0.4.2"]
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ aiounifi==64
|
|||||||
aiovlc==0.1.0
|
aiovlc==0.1.0
|
||||||
|
|
||||||
# homeassistant.components.vodafone_station
|
# homeassistant.components.vodafone_station
|
||||||
aiovodafone==0.4.1
|
aiovodafone==0.4.2
|
||||||
|
|
||||||
# homeassistant.components.waqi
|
# homeassistant.components.waqi
|
||||||
aiowaqi==2.1.0
|
aiowaqi==2.1.0
|
||||||
|
@ -350,7 +350,7 @@ aiounifi==64
|
|||||||
aiovlc==0.1.0
|
aiovlc==0.1.0
|
||||||
|
|
||||||
# homeassistant.components.vodafone_station
|
# homeassistant.components.vodafone_station
|
||||||
aiovodafone==0.4.1
|
aiovodafone==0.4.2
|
||||||
|
|
||||||
# homeassistant.components.waqi
|
# homeassistant.components.waqi
|
||||||
aiowaqi==2.1.0
|
aiowaqi==2.1.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user