From 5568531f74438b4f014d028cd5913517b6dc6d3b Mon Sep 17 00:00:00 2001 From: Mick Vleeshouwer Date: Tue, 15 Feb 2022 12:44:53 -0800 Subject: [PATCH] Improve exception catching and handling in Overkiz integration (#66604) --- homeassistant/components/overkiz/coordinator.py | 6 ++++++ homeassistant/components/overkiz/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/overkiz/coordinator.py b/homeassistant/components/overkiz/coordinator.py index ff7cd429ea5..cbf83a90963 100644 --- a/homeassistant/components/overkiz/coordinator.py +++ b/homeassistant/components/overkiz/coordinator.py @@ -9,8 +9,10 @@ from pyoverkiz.client import OverkizClient from pyoverkiz.enums import EventName, ExecutionState from pyoverkiz.exceptions import ( BadCredentialsException, + InvalidEventListenerIdException, MaintenanceException, NotAuthenticatedException, + TooManyConcurrentRequestsException, TooManyRequestsException, ) from pyoverkiz.models import Device, Event, Place @@ -67,10 +69,14 @@ class OverkizDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Device]]): events = await self.client.fetch_events() except BadCredentialsException as exception: raise ConfigEntryAuthFailed("Invalid authentication.") from exception + except TooManyConcurrentRequestsException as exception: + raise UpdateFailed("Too many concurrent requests.") from exception except TooManyRequestsException as exception: raise UpdateFailed("Too many requests, try again later.") from exception except MaintenanceException as exception: raise UpdateFailed("Server is down for maintenance.") from exception + except InvalidEventListenerIdException as exception: + raise UpdateFailed(exception) from exception except TimeoutError as exception: raise UpdateFailed("Failed to connect.") from exception except (ServerDisconnectedError, NotAuthenticatedException): diff --git a/homeassistant/components/overkiz/manifest.json b/homeassistant/components/overkiz/manifest.json index 1c08d47622d..7ad11809e6a 100644 --- a/homeassistant/components/overkiz/manifest.json +++ b/homeassistant/components/overkiz/manifest.json @@ -4,7 +4,7 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/overkiz", "requirements": [ - "pyoverkiz==1.3.4" + "pyoverkiz==1.3.5" ], "zeroconf": [ { diff --git a/requirements_all.txt b/requirements_all.txt index 746011521e8..ab13c9020b2 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1749,7 +1749,7 @@ pyotgw==1.1b1 pyotp==2.6.0 # homeassistant.components.overkiz -pyoverkiz==1.3.4 +pyoverkiz==1.3.5 # homeassistant.components.openweathermap pyowm==3.2.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 815d290118a..e2d7f2ec6f3 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1118,7 +1118,7 @@ pyotgw==1.1b1 pyotp==2.6.0 # homeassistant.components.overkiz -pyoverkiz==1.3.4 +pyoverkiz==1.3.5 # homeassistant.components.openweathermap pyowm==3.2.0