mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
Fix iaqualink exception handling after switch to httpx (#87898)
Fix exception handling after switch to httpx
This commit is contained in:
parent
32a6280139
commit
6680e819e5
@ -7,7 +7,7 @@ from functools import wraps
|
||||
import logging
|
||||
from typing import Any, Concatenate, ParamSpec, TypeVar
|
||||
|
||||
import aiohttp.client_exceptions
|
||||
import httpx
|
||||
from iaqualink.client import AqualinkClient
|
||||
from iaqualink.device import (
|
||||
AqualinkBinarySensor,
|
||||
@ -77,10 +77,7 @@ async def async_setup_entry( # noqa: C901
|
||||
_LOGGER.error("Failed to login: %s", login_exception)
|
||||
await aqualink.close()
|
||||
return False
|
||||
except (
|
||||
asyncio.TimeoutError,
|
||||
aiohttp.client_exceptions.ClientConnectorError,
|
||||
) as aio_exception:
|
||||
except (asyncio.TimeoutError, httpx.HTTPError) as aio_exception:
|
||||
await aqualink.close()
|
||||
raise ConfigEntryNotReady(
|
||||
f"Error while attempting login: {aio_exception}"
|
||||
@ -149,7 +146,7 @@ async def async_setup_entry( # noqa: C901
|
||||
|
||||
try:
|
||||
await system.update()
|
||||
except AqualinkServiceException as svc_exception:
|
||||
except (AqualinkServiceException, httpx.HTTPError) as svc_exception:
|
||||
if prev is not None:
|
||||
_LOGGER.warning(
|
||||
"Failed to refresh system %s state: %s",
|
||||
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
from iaqualink.client import AqualinkClient
|
||||
from iaqualink.exception import (
|
||||
AqualinkServiceException,
|
||||
@ -42,7 +43,7 @@ class AqualinkFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
pass
|
||||
except AqualinkServiceUnauthorizedException:
|
||||
errors["base"] = "invalid_auth"
|
||||
except AqualinkServiceException:
|
||||
except (AqualinkServiceException, httpx.HTTPError):
|
||||
errors["base"] = "cannot_connect"
|
||||
else:
|
||||
return self.async_create_entry(title=username, data=user_input)
|
||||
|
Loading…
x
Reference in New Issue
Block a user