mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Use RequestError in tradfri (#67101)
This commit is contained in:
parent
c11663344d
commit
93247d7933
@ -5,7 +5,7 @@ from datetime import datetime, timedelta
|
|||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from pytradfri import Gateway, PytradfriError, RequestError
|
from pytradfri import Gateway, RequestError
|
||||||
from pytradfri.api.aiocoap_api import APIFactory
|
from pytradfri.api.aiocoap_api import APIFactory
|
||||||
from pytradfri.command import Command
|
from pytradfri.command import Command
|
||||||
from pytradfri.device import Device
|
from pytradfri.device import Device
|
||||||
@ -149,7 +149,7 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
groups = await api(groups_commands, timeout=TIMEOUT_API)
|
groups = await api(groups_commands, timeout=TIMEOUT_API)
|
||||||
|
|
||||||
except PytradfriError as exc:
|
except RequestError as exc:
|
||||||
await factory.shutdown()
|
await factory.shutdown()
|
||||||
raise ConfigEntryNotReady from exc
|
raise ConfigEntryNotReady from exc
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from typing import Any, cast
|
|||||||
|
|
||||||
from pytradfri.command import Command
|
from pytradfri.command import Command
|
||||||
from pytradfri.device import Device
|
from pytradfri.device import Device
|
||||||
from pytradfri.error import PytradfriError
|
from pytradfri.error import RequestError
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
@ -31,7 +31,7 @@ def handle_error(
|
|||||||
"""Decorate api call."""
|
"""Decorate api call."""
|
||||||
try:
|
try:
|
||||||
await func(command)
|
await func(command)
|
||||||
except PytradfriError as err:
|
except RequestError as err:
|
||||||
_LOGGER.error("Unable to execute command %s: %s", command, err)
|
_LOGGER.error("Unable to execute command %s: %s", command, err)
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
Loading…
x
Reference in New Issue
Block a user