mirror of
https://github.com/home-assistant/core.git
synced 2025-05-01 12:47:53 +00:00
Expose TimeoutError during google_travel_time config_flow (#108179)
Expose TimeoutError during config_flow
This commit is contained in:
parent
cdf3c07488
commit
384b22c777
@ -192,6 +192,8 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
)
|
)
|
||||||
except InvalidApiKeyException:
|
except InvalidApiKeyException:
|
||||||
errors["base"] = "invalid_auth"
|
errors["base"] = "invalid_auth"
|
||||||
|
except TimeoutError:
|
||||||
|
errors["base"] = "timeout_connect"
|
||||||
except UnknownException:
|
except UnknownException:
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ def validate_config_entry(
|
|||||||
raise UnknownException() from transport_error
|
raise UnknownException() from transport_error
|
||||||
except Timeout as timeout_error:
|
except Timeout as timeout_error:
|
||||||
_LOGGER.error("Timeout error")
|
_LOGGER.error("Timeout error")
|
||||||
raise UnknownException() from timeout_error
|
raise TimeoutError() from timeout_error
|
||||||
|
|
||||||
|
|
||||||
class InvalidApiKeyException(Exception):
|
class InvalidApiKeyException(Exception):
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
|
||||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||||
|
"timeout_connect": "[%key:common::config_flow::error::timeout_connect%]"
|
||||||
},
|
},
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured": "[%key:common::config_flow::abort::already_configured_location%]"
|
"already_configured": "[%key:common::config_flow::abort::already_configured_location%]"
|
||||||
|
@ -115,7 +115,7 @@ async def test_timeout(hass: HomeAssistant) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
assert result2["type"] == data_entry_flow.FlowResultType.FORM
|
||||||
assert result2["errors"] == {"base": "cannot_connect"}
|
assert result2["errors"] == {"base": "timeout_connect"}
|
||||||
|
|
||||||
|
|
||||||
async def test_malformed_api_key(hass: HomeAssistant) -> None:
|
async def test_malformed_api_key(hass: HomeAssistant) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user