mirror of
https://github.com/esphome/esphome.git
synced 2024-12-24 22:44:54 +01:00
Better validation error messages
This commit is contained in:
parent
c3b3ba4923
commit
4f375757a5
2 changed files with 6 additions and 2 deletions
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue