mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Treat temporary errors as warnings for Tesla (#54515)
* Treat temporary errors as warnings for Tesla closes #53391 * Apply suggestions from code review Co-authored-by: J. Nick Koston <nick@koston.org> * Black Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
54da424507
commit
ee7116d0e8
@ -177,6 +177,15 @@ async def async_setup_entry(hass, config_entry):
|
|||||||
await async_client.aclose()
|
await async_client.aclose()
|
||||||
if ex.code == HTTP_UNAUTHORIZED:
|
if ex.code == HTTP_UNAUTHORIZED:
|
||||||
raise ConfigEntryAuthFailed from ex
|
raise ConfigEntryAuthFailed from ex
|
||||||
|
if ex.message in [
|
||||||
|
"VEHICLE_UNAVAILABLE",
|
||||||
|
"TOO_MANY_REQUESTS",
|
||||||
|
"SERVICE_MAINTENANCE",
|
||||||
|
"UPSTREAM_TIMEOUT",
|
||||||
|
]:
|
||||||
|
raise ConfigEntryNotReady(
|
||||||
|
f"Temporarily unable to communicate with Tesla API: {ex.message}"
|
||||||
|
) from ex
|
||||||
_LOGGER.error("Unable to communicate with Tesla API: %s", ex.message)
|
_LOGGER.error("Unable to communicate with Tesla API: %s", ex.message)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ async def validate_input(hass: core.HomeAssistant, data):
|
|||||||
if ex.code == HTTP_UNAUTHORIZED:
|
if ex.code == HTTP_UNAUTHORIZED:
|
||||||
_LOGGER.error("Invalid credentials: %s", ex)
|
_LOGGER.error("Invalid credentials: %s", ex)
|
||||||
raise InvalidAuth() from ex
|
raise InvalidAuth() from ex
|
||||||
_LOGGER.error("Unable to communicate with Tesla API: %s", ex)
|
_LOGGER.error("Unable to communicate with Tesla API: %s", ex.message)
|
||||||
raise CannotConnect() from ex
|
raise CannotConnect() from ex
|
||||||
finally:
|
finally:
|
||||||
await async_client.aclose()
|
await async_client.aclose()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user