Expose TimeoutError during google_travel_time config_flow (#108179)
Expose TimeoutError during config_flowpull/108384/head
parent
cdf3c07488
commit
384b22c777
|
@ -192,6 +192,8 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
)
|
||||
except InvalidApiKeyException:
|
||||
errors["base"] = "invalid_auth"
|
||||
except TimeoutError:
|
||||
errors["base"] = "timeout_connect"
|
||||
except UnknownException:
|
||||
errors["base"] = "cannot_connect"
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ def validate_config_entry(
|
|||
raise UnknownException() from transport_error
|
||||
except Timeout as timeout_error:
|
||||
_LOGGER.error("Timeout error")
|
||||
raise UnknownException() from timeout_error
|
||||
raise TimeoutError() from timeout_error
|
||||
|
||||
|
||||
class InvalidApiKeyException(Exception):
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
},
|
||||
"error": {
|
||||
"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": {
|
||||
"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["errors"] == {"base": "cannot_connect"}
|
||||
assert result2["errors"] == {"base": "timeout_connect"}
|
||||
|
||||
|
||||
async def test_malformed_api_key(hass: HomeAssistant) -> None:
|
||||
|
|
Loading…
Reference in New Issue