From 4f375757a561d15a7d2a0a9e78f5c1ced7c8d1bf Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Mon, 12 Nov 2018 21:00:17 +0100 Subject: [PATCH] Better validation error messages --- esphomeyaml/automation.py | 5 ++++- esphomeyaml/espota2.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/esphomeyaml/automation.py b/esphomeyaml/automation.py index c8dd9dab54..d7194171d4 100644 --- a/esphomeyaml/automation.py +++ b/esphomeyaml/automation.py @@ -44,7 +44,8 @@ def validate_recursive_action(value): item.setdefault(CONF_ACTION_ID, None) key2 = next((x for x in item if x != CONF_ACTION_ID and x != key), None) if key2 is not None: - raise vol.Invalid(u"Cannot have two actions in one item. Key {} overrides {}!" + raise vol.Invalid(u"Cannot have two actions in one item. Key '{}' overrides '{}'! " + u"Did you forget to indent the action?" u"".format(key, key2)) validator = ACTION_REGISTRY[key][0] value[i] = { @@ -94,6 +95,8 @@ def validate_automation(extra_schema=None, extra_validators=None, single=False): try: return vol.Schema([schema])(value) except vol.Invalid as err2: + if 'Unable to find action' in str(err): + raise err2 raise vol.MultipleInvalid([err, err2]) elif isinstance(value, dict): if CONF_THEN in value: diff --git a/esphomeyaml/espota2.py b/esphomeyaml/espota2.py index 92a7964ff4..2e1e96df68 100755 --- a/esphomeyaml/espota2.py +++ b/esphomeyaml/espota2.py @@ -221,6 +221,7 @@ def is_ip_address(host): def resolve_ip_address(host): if is_ip_address(host): + _LOGGER.info("Connecting to %s", host) return host _LOGGER.info("Resolving IP Address of %s", host) @@ -240,7 +241,7 @@ def resolve_ip_address(host): host) _LOGGER.error("(If this error persists, please set a static IP address: " - "https://esphomelib.com/esphomeyaml/components/wifi.html#manual-ips") + "https://esphomelib.com/esphomeyaml/components/wifi.html#manual-ips)") raise OTAError("Errors: {}".format(', '.join(str(x) for x in errors))) _LOGGER.info(" -> %s", ip)