Use RequestError in tradfri (#67101)
parent
c11663344d
commit
93247d7933
|
@ -5,7 +5,7 @@ from datetime import datetime, timedelta
|
|||
import logging
|
||||
from typing import Any
|
||||
|
||||
from pytradfri import Gateway, PytradfriError, RequestError
|
||||
from pytradfri import Gateway, RequestError
|
||||
from pytradfri.api.aiocoap_api import APIFactory
|
||||
from pytradfri.command import Command
|
||||
from pytradfri.device import Device
|
||||
|
@ -149,7 +149,7 @@ async def async_setup_entry(
|
|||
)
|
||||
groups = await api(groups_commands, timeout=TIMEOUT_API)
|
||||
|
||||
except PytradfriError as exc:
|
||||
except RequestError as exc:
|
||||
await factory.shutdown()
|
||||
raise ConfigEntryNotReady from exc
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from typing import Any, cast
|
|||
|
||||
from pytradfri.command import Command
|
||||
from pytradfri.device import Device
|
||||
from pytradfri.error import PytradfriError
|
||||
from pytradfri.error import RequestError
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
@ -31,7 +31,7 @@ def handle_error(
|
|||
"""Decorate api call."""
|
||||
try:
|
||||
await func(command)
|
||||
except PytradfriError as err:
|
||||
except RequestError as err:
|
||||
_LOGGER.error("Unable to execute command %s: %s", command, err)
|
||||
|
||||
return wrapper
|
||||
|
|
Loading…
Reference in New Issue