mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Improve config validation error message
This commit is contained in:
@@ -104,7 +104,7 @@ def _setup_component(hass, domain, config):
|
||||
try:
|
||||
config = component.CONFIG_SCHEMA(config)
|
||||
except vol.MultipleInvalid as ex:
|
||||
cv.log_exception(_LOGGER, ex, domain)
|
||||
cv.log_exception(_LOGGER, ex, domain, config)
|
||||
return False
|
||||
|
||||
elif hasattr(component, 'PLATFORM_SCHEMA'):
|
||||
@@ -114,11 +114,11 @@ def _setup_component(hass, domain, config):
|
||||
try:
|
||||
p_validated = component.PLATFORM_SCHEMA(p_config)
|
||||
except vol.MultipleInvalid as ex:
|
||||
cv.log_exception(_LOGGER, ex, domain)
|
||||
cv.log_exception(_LOGGER, ex, domain, p_config)
|
||||
return False
|
||||
|
||||
# Not all platform components follow same pattern for platforms
|
||||
# Sof if p_name is None we are not going to validate platform
|
||||
# So if p_name is None we are not going to validate platform
|
||||
# (the automation component is one of them)
|
||||
if p_name is None:
|
||||
platforms.append(p_validated)
|
||||
@@ -136,7 +136,7 @@ def _setup_component(hass, domain, config):
|
||||
p_validated = platform.PLATFORM_SCHEMA(p_validated)
|
||||
except vol.MultipleInvalid as ex:
|
||||
cv.log_exception(_LOGGER, ex, '{}.{}'
|
||||
.format(domain, p_name))
|
||||
.format(domain, p_name), p_validated)
|
||||
return False
|
||||
|
||||
platforms.append(p_validated)
|
||||
@@ -228,11 +228,13 @@ def from_config_dict(config, hass=None, config_dir=None, enable_log=True,
|
||||
hass.config.config_dir = config_dir
|
||||
mount_local_lib_path(config_dir)
|
||||
|
||||
core_config = config.get(core.DOMAIN, {})
|
||||
|
||||
try:
|
||||
process_ha_core_config(hass, config_util.CORE_CONFIG_SCHEMA(
|
||||
config.get(core.DOMAIN, {})))
|
||||
core_config))
|
||||
except vol.MultipleInvalid as ex:
|
||||
cv.log_exception(_LOGGER, ex, 'homeassistant')
|
||||
cv.log_exception(_LOGGER, ex, 'homeassistant', core_config)
|
||||
return None
|
||||
|
||||
process_ha_config_upgrade(hass)
|
||||
|
||||
Reference in New Issue
Block a user