Use RequestError in tradfri (#67101)

pull/67095/head^2
Martin Hjelmare 2022-02-23 09:34:32 +01:00 committed by GitHub
parent c11663344d
commit 93247d7933
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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