mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Ignore more loading errors (#14331)
This commit is contained in:
parent
6318178a8b
commit
c7166241f7
@ -105,7 +105,16 @@ def get_component(hass, comp_or_platform) -> Optional[ModuleType]:
|
|||||||
except ImportError as err:
|
except ImportError as err:
|
||||||
# This error happens if for example custom_components/switch
|
# This error happens if for example custom_components/switch
|
||||||
# exists and we try to load switch.demo.
|
# exists and we try to load switch.demo.
|
||||||
if str(err) != "No module named '{}'".format(path):
|
# Ignore errors for custom_components, custom_components.switch
|
||||||
|
# and custom_components.switch.demo.
|
||||||
|
white_listed_errors = []
|
||||||
|
parts = []
|
||||||
|
for part in path.split('.'):
|
||||||
|
parts.append(part)
|
||||||
|
white_listed_errors.append(
|
||||||
|
"No module named '{}'".format('.'.join(parts)))
|
||||||
|
|
||||||
|
if str(err) not in white_listed_errors:
|
||||||
_LOGGER.exception(
|
_LOGGER.exception(
|
||||||
("Error loading %s. Make sure all "
|
("Error loading %s. Make sure all "
|
||||||
"dependencies are installed"), path)
|
"dependencies are installed"), path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user