mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-30 05:13:40 +00:00
fix: update return type annotation for API request method and ensure exceptions are raised
This commit is contained in:
parent
12fbe33bb9
commit
da5a723777
1 changed files with 3 additions and 1 deletions
|
|
@ -576,7 +576,7 @@ class TibberPricesApiClient:
|
||||||
headers: dict[str, str],
|
headers: dict[str, str],
|
||||||
data: dict,
|
data: dict,
|
||||||
query_type: QueryType,
|
query_type: QueryType,
|
||||||
) -> dict:
|
) -> dict[str, Any]:
|
||||||
"""Make an API request with comprehensive error handling for network issues."""
|
"""Make an API request with comprehensive error handling for network issues."""
|
||||||
_LOGGER.debug("Making API request with data: %s", data)
|
_LOGGER.debug("Making API request with data: %s", data)
|
||||||
|
|
||||||
|
|
@ -633,9 +633,11 @@ class TibberPricesApiClient:
|
||||||
|
|
||||||
except socket.gaierror as error:
|
except socket.gaierror as error:
|
||||||
self._handle_dns_error(error)
|
self._handle_dns_error(error)
|
||||||
|
raise # Ensure type checker knows this path always raises
|
||||||
|
|
||||||
except OSError as error:
|
except OSError as error:
|
||||||
self._handle_network_error(error)
|
self._handle_network_error(error)
|
||||||
|
raise # Ensure type checker knows this path always raises
|
||||||
|
|
||||||
def _handle_dns_error(self, error: socket.gaierror) -> None:
|
def _handle_dns_error(self, error: socket.gaierror) -> None:
|
||||||
"""Handle DNS resolution errors with IPv4/IPv6 dual stack considerations."""
|
"""Handle DNS resolution errors with IPv4/IPv6 dual stack considerations."""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue