Improve WS command validate_config (#118864)

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
Erik Montnemery 2024-06-05 18:53:44 +02:00 committed by GitHub
parent 6efc3b95a4
commit 8099ea8817
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 7 deletions

View file

@ -862,7 +862,10 @@ async def handle_validate_config(
try:
await validator(hass, schema(msg[key]))
except vol.Invalid as err:
except (
vol.Invalid,
HomeAssistantError,
) as err:
result[key] = {"valid": False, "error": str(err)}
else:
result[key] = {"valid": True, "error": None}