Merge otto/ha-client-errors into main
This commit is contained in:
@@ -4,14 +4,20 @@ from __future__ import annotations
|
||||
class HaClientError(Exception):
|
||||
"""Basisklasse für HA-Client-Fehler."""
|
||||
|
||||
public_detail: str | None = None
|
||||
|
||||
|
||||
class HaTimeoutError(HaClientError):
|
||||
"""Zeitüberschreitung bei Request an Home Assistant."""
|
||||
|
||||
public_detail = "Home Assistant request timed out."
|
||||
|
||||
|
||||
class HaHttpError(HaClientError):
|
||||
"""Nicht erfolgreicher HTTP-Statuscode."""
|
||||
|
||||
public_detail = "Home Assistant request failed."
|
||||
|
||||
def __init__(self, status_code: int, message: str = "") -> None:
|
||||
super().__init__(message)
|
||||
self.status_code = status_code
|
||||
@@ -20,6 +26,10 @@ class HaHttpError(HaClientError):
|
||||
class HaAuthError(HaHttpError):
|
||||
"""Authentifizierung oder Berechtigung fehlgeschlagen."""
|
||||
|
||||
public_detail = "Home Assistant authentication failed."
|
||||
|
||||
|
||||
class HaUnexpectedPayloadError(HaClientError):
|
||||
"""Antwort hat nicht das erwartete Format."""
|
||||
"""Antwort hat nicht das erwartete Format."""
|
||||
|
||||
public_detail = "Home Assistant returned an unexpected payload."
|
||||
Reference in New Issue
Block a user