chore: add some constants for exception messages to satisfy the linter

This commit is contained in:
Xavier Morel
2025-03-21 17:54:03 +01:00
parent 1c6c04dd33
commit 49d40a3a92
3 changed files with 27 additions and 14 deletions

View File

@@ -13,7 +13,7 @@ from homeassistant.exceptions import ConfigEntryAuthFailed
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from .client import CollectionEvent, EcocitoClient, WasteDepotVisit
from .const import DOMAIN, LOGGER
from .const import DOMAIN, ECOCITO_MESSAGE_REAUTHENTICATE, LOGGER
from .errors import CannotConnectError, InvalidAuthenticationError
T = TypeVar("T", bound=list[CollectionEvent] | list[WasteDepotVisit])
@@ -46,9 +46,7 @@ class EcocitoDataUpdateCoordinator(DataUpdateCoordinator[T], Generic[T], ABC):
except CannotConnectError as ex:
raise UpdateFailed(ex) from ex
except InvalidAuthenticationError as ex:
raise ConfigEntryAuthFailed(
"Credentials are no longer valid. Please reauthenticate"
) from ex
raise ConfigEntryAuthFailed(ECOCITO_MESSAGE_REAUTHENTICATE) from ex
@abstractmethod
async def _fetch_data(self) -> T: