Remove reserved UpdateFailed exception in AsusWRT (#110910)

* Remove reserved UpdateFailed exception in AsusWRT

* Restore UpdateFailed exception in decorator
This commit is contained in:
ollo69 2024-02-22 09:53:40 +01:00 committed by GitHub
parent 6e91776d65
commit 52621f9609
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 11 deletions

View File

@ -211,10 +211,7 @@ class AsusWrtLegacyBridge(AsusWrtBridge):
async def async_get_connected_devices(self) -> dict[str, WrtDevice]:
"""Get list of connected devices."""
try:
api_devices = await self._api.async_get_connected_devices()
except OSError as exc:
raise UpdateFailed(exc) from exc
api_devices = await self._api.async_get_connected_devices()
return {
format_mac(mac): WrtDevice(dev.ip, dev.name, None)
for mac, dev in api_devices.items()
@ -343,10 +340,7 @@ class AsusWrtHttpBridge(AsusWrtBridge):
async def async_get_connected_devices(self) -> dict[str, WrtDevice]:
"""Get list of connected devices."""
try:
api_devices = await self._api.async_get_connected_devices()
except AsusWrtError as exc:
raise UpdateFailed(exc) from exc
api_devices = await self._api.async_get_connected_devices()
return {
format_mac(mac): WrtDevice(dev.ip, dev.name, dev.node)
for mac, dev in api_devices.items()

View File

@ -216,7 +216,7 @@ class AsusWrtFlowHandler(ConfigFlow, domain=DOMAIN):
if error is not None:
return error, None
_LOGGER.info(
_LOGGER.debug(
"Successfully connected to the AsusWrt router at %s using protocol %s",
host,
protocol,

View File

@ -20,7 +20,7 @@ from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.device_registry import DeviceInfo, format_mac
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.event import async_track_time_interval
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.util import dt as dt_util, slugify
from .bridge import AsusWrtBridge, WrtDevice
@ -276,7 +276,7 @@ class AsusWrtRouter:
_LOGGER.debug("Checking devices for ASUS router %s", self.host)
try:
wrt_devices = await self._api.async_get_connected_devices()
except UpdateFailed as exc:
except (OSError, AsusWrtError) as exc:
if not self._connect_error:
self._connect_error = True
_LOGGER.error(