mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Remove redundant exception and catch NotSuchTokenException in Overkiz integration (#103584)
This commit is contained in:
parent
8e99760595
commit
3697567f18
@ -5,13 +5,14 @@ import asyncio
|
||||
from collections import defaultdict
|
||||
from dataclasses import dataclass
|
||||
|
||||
from aiohttp import ClientError, ServerDisconnectedError
|
||||
from aiohttp import ClientError
|
||||
from pyoverkiz.client import OverkizClient
|
||||
from pyoverkiz.const import SUPPORTED_SERVERS
|
||||
from pyoverkiz.enums import OverkizState, UIClass, UIWidget
|
||||
from pyoverkiz.exceptions import (
|
||||
BadCredentialsException,
|
||||
MaintenanceException,
|
||||
NotSuchTokenException,
|
||||
TooManyRequestsException,
|
||||
)
|
||||
from pyoverkiz.models import Device, Scenario
|
||||
@ -67,11 +68,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
client.get_scenarios(),
|
||||
]
|
||||
)
|
||||
except BadCredentialsException as exception:
|
||||
except (BadCredentialsException, NotSuchTokenException) as exception:
|
||||
raise ConfigEntryAuthFailed("Invalid authentication") from exception
|
||||
except TooManyRequestsException as exception:
|
||||
raise ConfigEntryNotReady("Too many requests, try again later") from exception
|
||||
except (TimeoutError, ClientError, ServerDisconnectedError) as exception:
|
||||
except (TimeoutError, ClientError) as exception:
|
||||
raise ConfigEntryNotReady("Failed to connect") from exception
|
||||
except MaintenanceException as exception:
|
||||
raise ConfigEntryNotReady("Server is down for maintenance") from exception
|
||||
|
Loading…
x
Reference in New Issue
Block a user