Fix component loader value error (#149)

* Print better error message when loader fails with ValueError

* Improve

* Improve
This commit is contained in:
Otto Winter 2018-10-07 14:38:22 +02:00 committed by GitHub
parent 7ce753b76f
commit 0374b3a0b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,7 +28,7 @@ def get_component(domain):
path = 'esphomeyaml.components.{}'.format(domain)
try:
module = importlib.import_module(path)
except ImportError as err:
except (ImportError, ValueError) as err:
_LOGGER.debug(err)
else:
_COMPONENT_CACHE[domain] = module
@ -183,7 +183,7 @@ def validate_config(config):
p_domain = u'{}.{}'.format(domain, p_name)
platform = get_platform(domain, p_name)
if platform is None:
result.add_error(u"Platform not found: {}".format(p_domain), p_domain, p_config)
result.add_error(u"Platform not found: '{}'".format(p_domain), p_domain, p_config)
continue
success = True