mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Add translation to coordinator exceptions in solarlog (#131523)
This commit is contained in:
parent
bd69af5500
commit
f6ef2d730b
@ -83,15 +83,27 @@ class SolarLogCoordinator(DataUpdateCoordinator[SolarlogData]):
|
|||||||
await self.solarlog.update_device_list()
|
await self.solarlog.update_device_list()
|
||||||
data.inverter_data = await self.solarlog.update_inverter_data()
|
data.inverter_data = await self.solarlog.update_inverter_data()
|
||||||
except SolarLogConnectionError as ex:
|
except SolarLogConnectionError as ex:
|
||||||
raise ConfigEntryNotReady(ex) from ex
|
raise ConfigEntryNotReady(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="config_entry_not_ready",
|
||||||
|
) from ex
|
||||||
except SolarLogAuthenticationError as ex:
|
except SolarLogAuthenticationError as ex:
|
||||||
if await self.renew_authentication():
|
if await self.renew_authentication():
|
||||||
# login was successful, update availability of extended data, retry data update
|
# login was successful, update availability of extended data, retry data update
|
||||||
await self.solarlog.test_extended_data_available()
|
await self.solarlog.test_extended_data_available()
|
||||||
raise ConfigEntryNotReady from ex
|
raise ConfigEntryNotReady(
|
||||||
raise ConfigEntryAuthFailed from ex
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="config_entry_not_ready",
|
||||||
|
) from ex
|
||||||
|
raise ConfigEntryAuthFailed(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="auth_failed",
|
||||||
|
) from ex
|
||||||
except SolarLogUpdateError as ex:
|
except SolarLogUpdateError as ex:
|
||||||
raise UpdateFailed(ex) from ex
|
raise UpdateFailed(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="update_failed",
|
||||||
|
) from ex
|
||||||
|
|
||||||
_LOGGER.debug("Data successfully updated")
|
_LOGGER.debug("Data successfully updated")
|
||||||
|
|
||||||
@ -150,9 +162,15 @@ class SolarLogCoordinator(DataUpdateCoordinator[SolarlogData]):
|
|||||||
try:
|
try:
|
||||||
logged_in = await self.solarlog.login()
|
logged_in = await self.solarlog.login()
|
||||||
except SolarLogAuthenticationError as ex:
|
except SolarLogAuthenticationError as ex:
|
||||||
raise ConfigEntryAuthFailed from ex
|
raise ConfigEntryAuthFailed(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="auth_failed",
|
||||||
|
) from ex
|
||||||
except (SolarLogConnectionError, SolarLogUpdateError) as ex:
|
except (SolarLogConnectionError, SolarLogUpdateError) as ex:
|
||||||
raise ConfigEntryNotReady from ex
|
raise ConfigEntryNotReady(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="config_entry_not_ready",
|
||||||
|
) from ex
|
||||||
|
|
||||||
_LOGGER.debug("Credentials successfully updated? %s", logged_in)
|
_LOGGER.debug("Credentials successfully updated? %s", logged_in)
|
||||||
|
|
||||||
|
@ -121,5 +121,16 @@
|
|||||||
"name": "Usage"
|
"name": "Usage"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"exceptions": {
|
||||||
|
"update_error": {
|
||||||
|
"message": "Error while updating data from the API."
|
||||||
|
},
|
||||||
|
"config_entry_not_ready": {
|
||||||
|
"message": "Error while loading the config entry."
|
||||||
|
},
|
||||||
|
"auth_failed": {
|
||||||
|
"message": "Error while logging in to the API."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user