mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Comelit config flow timeout error (#142667)
This commit is contained in:
parent
6fafafbed0
commit
bb3c2175bc
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from asyncio.exceptions import TimeoutError
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -53,10 +54,18 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str,
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
await api.login()
|
await api.login()
|
||||||
except aiocomelit_exceptions.CannotConnect as err:
|
except (aiocomelit_exceptions.CannotConnect, TimeoutError) as err:
|
||||||
raise CannotConnect from err
|
raise CannotConnect(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="cannot_connect",
|
||||||
|
translation_placeholders={"error": repr(err)},
|
||||||
|
) from err
|
||||||
except aiocomelit_exceptions.CannotAuthenticate as err:
|
except aiocomelit_exceptions.CannotAuthenticate as err:
|
||||||
raise InvalidAuth from err
|
raise InvalidAuth(
|
||||||
|
translation_domain=DOMAIN,
|
||||||
|
translation_key="cannot_authenticate",
|
||||||
|
translation_placeholders={"error": repr(err)},
|
||||||
|
) from err
|
||||||
finally:
|
finally:
|
||||||
await api.logout()
|
await api.logout()
|
||||||
await api.close()
|
await api.close()
|
||||||
|
@ -69,6 +69,12 @@
|
|||||||
},
|
},
|
||||||
"invalid_clima_data": {
|
"invalid_clima_data": {
|
||||||
"message": "Invalid 'clima' data"
|
"message": "Invalid 'clima' data"
|
||||||
|
},
|
||||||
|
"cannot_connect": {
|
||||||
|
"message": "Error connecting: {error}"
|
||||||
|
},
|
||||||
|
"cannot_authenticate": {
|
||||||
|
"message": "Error authenticating: {error}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user