Recreate iaqualink httpx client upon service exception (#89341)
This commit is contained in:
parent
5374c70c97
commit
2ec78ae70e
2 changed files with 3 additions and 1 deletions
|
@ -153,6 +153,7 @@ async def async_setup_entry( # noqa: C901
|
|||
system.serial,
|
||||
svc_exception,
|
||||
)
|
||||
await system.aqualink.close()
|
||||
else:
|
||||
cur = system.online
|
||||
if cur and not prev:
|
||||
|
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||
|
||||
from collections.abc import Awaitable
|
||||
|
||||
import httpx
|
||||
from iaqualink.exception import AqualinkServiceException
|
||||
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
@ -12,5 +13,5 @@ async def await_or_reraise(awaitable: Awaitable) -> None:
|
|||
"""Execute API call while catching service exceptions."""
|
||||
try:
|
||||
await awaitable
|
||||
except AqualinkServiceException as svc_exception:
|
||||
except (AqualinkServiceException, httpx.HTTPError) as svc_exception:
|
||||
raise HomeAssistantError(f"Aqualink error: {svc_exception}") from svc_exception
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue