From 6442625a9ddce9ebee560e13ea1e99310879fb6e Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:39:46 +0200 Subject: [PATCH] Fix incorrect error strings in webmin (#128448) --- homeassistant/components/webmin/config_flow.py | 7 +++---- tests/components/webmin/test_config_flow.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/webmin/config_flow.py b/homeassistant/components/webmin/config_flow.py index 3f55bbd91106e6..64f8c684dfac9d 100644 --- a/homeassistant/components/webmin/config_flow.py +++ b/homeassistant/components/webmin/config_flow.py @@ -26,7 +26,7 @@ SchemaFlowFormStep, ) -from .const import DEFAULT_PORT, DEFAULT_SSL, DEFAULT_VERIFY_SSL, DOMAIN +from .const import DEFAULT_PORT, DEFAULT_SSL, DEFAULT_VERIFY_SSL, DOMAIN, LOGGER from .helpers import get_instance_from_options, get_sorted_mac_addresses @@ -45,9 +45,8 @@ async def validate_user_input( raise SchemaFlowError("invalid_auth") from err raise SchemaFlowError("cannot_connect") from err except Fault as fault: - raise SchemaFlowError( - f"Fault {fault.faultCode}: {fault.faultString}" - ) from fault + LOGGER.exception(f"Fault {fault.faultCode}: {fault.faultString}") + raise SchemaFlowError("unknown") from fault except ClientConnectionError as err: raise SchemaFlowError("cannot_connect") from err except Exception as err: diff --git a/tests/components/webmin/test_config_flow.py b/tests/components/webmin/test_config_flow.py index 477ad230622d85..03da33405973a9 100644 --- a/tests/components/webmin/test_config_flow.py +++ b/tests/components/webmin/test_config_flow.py @@ -74,7 +74,7 @@ async def test_form_user( (Exception, "unknown"), ( Fault("5", "Webmin module net does not exist"), - "Fault 5: Webmin module net does not exist", + "unknown", ), ], )