25 lines
634 B
Python
25 lines
634 B
Python
from __future__ import annotations
|
|
|
|
|
|
class HaClientError(Exception):
|
|
"""Basisklasse für HA-Client-Fehler."""
|
|
|
|
|
|
class HaTimeoutError(HaClientError):
|
|
"""Zeitüberschreitung bei Request an Home Assistant."""
|
|
|
|
|
|
class HaHttpError(HaClientError):
|
|
"""Nicht erfolgreicher HTTP-Statuscode."""
|
|
|
|
def __init__(self, status_code: int, message: str = "") -> None:
|
|
super().__init__(message)
|
|
self.status_code = status_code
|
|
|
|
|
|
class HaAuthError(HaHttpError):
|
|
"""Authentifizierung oder Berechtigung fehlgeschlagen."""
|
|
|
|
|
|
class HaUnexpectedPayloadError(HaClientError):
|
|
"""Antwort hat nicht das erwartete Format.""" |