Improve exception catching and handling in Overkiz integration (#66604)

pull/66610/head
Mick Vleeshouwer 2022-02-15 12:44:53 -08:00 committed by GitHub
parent c5ae43144d
commit 5568531f74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 3 deletions

View File

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

View File

@ -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": [
{

View File

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

View File

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