mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 17:31:15 -04:00
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: frenck <195327+frenck@users.noreply.github.com>
17 lines
529 B
Python
17 lines
529 B
Python
"""Utility functions for Aqualink devices."""
|
|
|
|
from collections.abc import Awaitable
|
|
|
|
import httpx
|
|
from iaqualink.exception import AqualinkServiceException
|
|
|
|
from homeassistant.exceptions import HomeAssistantError
|
|
|
|
|
|
async def await_or_reraise(awaitable: Awaitable) -> None:
|
|
"""Execute API call while catching service exceptions."""
|
|
try:
|
|
await awaitable
|
|
except (AqualinkServiceException, httpx.HTTPError) as svc_exception:
|
|
raise HomeAssistantError(f"Aqualink error: {svc_exception}") from svc_exception
|