From 93247d7933a49ebe2b4592c71138f189b201fe32 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Wed, 23 Feb 2022 09:34:32 +0100 Subject: [PATCH] Use RequestError in tradfri (#67101) --- homeassistant/components/tradfri/__init__.py | 4 ++-- homeassistant/components/tradfri/base_class.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/tradfri/__init__.py b/homeassistant/components/tradfri/__init__.py index c11b9874bae..1971b14b2be 100644 --- a/homeassistant/components/tradfri/__init__.py +++ b/homeassistant/components/tradfri/__init__.py @@ -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 diff --git a/homeassistant/components/tradfri/base_class.py b/homeassistant/components/tradfri/base_class.py index 8c4f483b9a8..a2bd28e3868 100644 --- a/homeassistant/components/tradfri/base_class.py +++ b/homeassistant/components/tradfri/base_class.py @@ -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