Make yaml config parser errors look less like bugs. (#1776)

Instead of nested tracebacks, show a simpler error message.

    Config directory: /home/user/.homeassistant
    ERROR:homeassistant.util.yaml:duplicate key: "script"
      in "/home/user/.homeassistant/configuration.yaml", line 95, column 0
      in "/home/user/.homeassistant/configuration.yaml", line 108, column 0
This commit is contained in:
Jan Harkes
2016-04-09 18:25:01 -04:00
committed by Paulus Schoutsen
parent b87e2437aa
commit 73859f59f0
2 changed files with 14 additions and 8 deletions

View File

@@ -22,6 +22,7 @@ from homeassistant.const import (
CONF_CUSTOMIZE, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME,
CONF_TEMPERATURE_UNIT, CONF_TIME_ZONE, EVENT_COMPONENT_LOADED,
TEMP_CELCIUS, TEMP_FAHRENHEIT, PLATFORM_FORMAT, __version__)
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import (
event_decorators, service, config_per_platform, extract_domain_configs)
from homeassistant.helpers.entity import Entity
@@ -293,7 +294,10 @@ def from_config_file(config_path, hass=None, verbose=False, daemon=False,
enable_logging(hass, verbose, daemon, log_rotate_days)
config_dict = config_util.load_yaml_config_file(config_path)
try:
config_dict = config_util.load_yaml_config_file(config_path)
except HomeAssistantError:
return None
return from_config_dict(config_dict, hass, enable_log=False,
skip_pip=skip_pip)