Catch unexpected exceptions when validating config (#31795)
This commit is contained in:
1 parent
6211a2bb98
commit
fbbb29a6ec
2 files changed
+117
-1
No files matched your search
@@ -697,6 +697,9 @@ async def async_process_component_config(
|
||||
except (vol.Invalid, HomeAssistantError) as ex:
|
||||
async_log_exception(ex, domain, config, hass, integration.documentation)
|
||||
return None
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception("Unknown error calling %s config validator", domain)
|
||||
return None
|
||||
|
||||
# No custom config validator, proceed with schema validation
|
||||
if hasattr(component, "CONFIG_SCHEMA"):
|
||||
@@ -705,6 +708,9 @@ async def async_process_component_config(
|
||||
except vol.Invalid as ex:
|
||||
async_log_exception(ex, domain, config, hass, integration.documentation)
|
||||
return None
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception("Unknown error calling %s CONFIG_SCHEMA", domain)
|
||||
return None
|
||||
|
||||
component_platform_schema = getattr(
|
||||
component, "PLATFORM_SCHEMA_BASE", getattr(component, "PLATFORM_SCHEMA", None)
|
||||
@@ -721,6 +727,13 @@ async def async_process_component_config(
|
||||
except vol.Invalid as ex:
|
||||
async_log_exception(ex, domain, p_config, hass, integration.documentation)
|
||||
continue
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception(
|
||||
"Unknown error validating %s platform config with %s component platform schema",
|
||||
p_name,
|
||||
domain,
|
||||
)
|
||||
continue
|
||||
|
||||
# Not all platform components follow same pattern for platforms
|
||||
# So if p_name is None we are not going to validate platform
|
||||
@@ -756,6 +769,13 @@ async def async_process_component_config(
|
||||
p_integration.documentation,
|
||||
)
|
||||
continue
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception(
|
||||
"Unknown error validating config for %s platform for %s component with PLATFORM_SCHEMA",
|
||||
p_name,
|
||||
domain,
|
||||
)
|
||||
continue
|
||||
|
||||
platforms.append(p_validated)
|
||||
|
||||
|
||||
Reference in new issue
Block a user