mirror of
https://github.com/home-assistant/core.git
synced 2026-04-17 15:44:52 +01:00
Fix mixed-language Splunk setup errors in exception translations (#165974)
This commit is contained in:
@@ -178,31 +178,24 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
connectivity=False, token=True, busy=False
|
||||
)
|
||||
except ClientConnectionError as err:
|
||||
_LOGGER.debug("Connection error during setup at %s:%s: %s", host, port, err)
|
||||
raise ConfigEntryNotReady(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="connection_error",
|
||||
translation_placeholders={
|
||||
"host": host,
|
||||
"port": str(port),
|
||||
"error": str(err),
|
||||
},
|
||||
translation_key="cannot_connect",
|
||||
translation_placeholders={"host": host, "port": str(port)},
|
||||
) from err
|
||||
except TimeoutError as err:
|
||||
_LOGGER.debug("Timeout during setup at %s:%s: %s", host, port, err)
|
||||
raise ConfigEntryNotReady(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="timeout_connect",
|
||||
translation_placeholders={"host": host, "port": str(port)},
|
||||
) from err
|
||||
except Exception as err:
|
||||
_LOGGER.exception("Unexpected error setting up Splunk")
|
||||
_LOGGER.exception("Unexpected setup error at %s:%s", host, port)
|
||||
raise ConfigEntryNotReady(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="unexpected_error",
|
||||
translation_placeholders={
|
||||
"host": host,
|
||||
"port": str(port),
|
||||
"error": str(err),
|
||||
},
|
||||
translation_key="unexpected_connect_error",
|
||||
) from err
|
||||
|
||||
if not connectivity_ok:
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"name": "[%key:common::config_flow::data::name%]",
|
||||
"port": "[%key:common::config_flow::data::port%]",
|
||||
"ssl": "[%key:common::config_flow::data::ssl%]",
|
||||
"token": "HTTP Event Collector token",
|
||||
"token": "[%key:component::splunk::config::step::user::data::token%]",
|
||||
"verify_ssl": "[%key:common::config_flow::data::verify_ssl%]"
|
||||
},
|
||||
"data_description": {
|
||||
@@ -72,17 +72,14 @@
|
||||
"cannot_connect": {
|
||||
"message": "Unable to connect to Splunk at {host}:{port}."
|
||||
},
|
||||
"connection_error": {
|
||||
"message": "Unable to connect to Splunk at {host}:{port}: {error}."
|
||||
},
|
||||
"invalid_auth": {
|
||||
"message": "[%key:common::config_flow::error::invalid_auth%]"
|
||||
},
|
||||
"timeout_connect": {
|
||||
"message": "Connection to Splunk at {host}:{port} timed out."
|
||||
},
|
||||
"unexpected_error": {
|
||||
"message": "Unexpected error while connecting to Splunk at {host}:{port}: {error}."
|
||||
"unexpected_connect_error": {
|
||||
"message": "Unexpected error while connecting to Splunk."
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
|
||||
@@ -47,13 +47,13 @@ async def test_setup_entry_success(
|
||||
(
|
||||
ClientConnectionError("Connection failed"),
|
||||
ConfigEntryState.SETUP_RETRY,
|
||||
"connection_error",
|
||||
"cannot_connect",
|
||||
),
|
||||
(TimeoutError(), ConfigEntryState.SETUP_RETRY, "timeout_connect"),
|
||||
(
|
||||
Exception("Unexpected error"),
|
||||
ConfigEntryState.SETUP_RETRY,
|
||||
"unexpected_error",
|
||||
"unexpected_connect_error",
|
||||
),
|
||||
([True, False], ConfigEntryState.SETUP_ERROR, "invalid_auth"),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user