From ecbacde665ae7e5684a09e5671967b511f02a199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Thu, 8 Aug 2019 10:51:36 +0200 Subject: [PATCH] Catch !includes with unfound files --- custom_components/lovelace_gen/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/lovelace_gen/__init__.py b/custom_components/lovelace_gen/__init__.py index 2e705fa..1c36538 100644 --- a/custom_components/lovelace_gen/__init__.py +++ b/custom_components/lovelace_gen/__init__.py @@ -31,10 +31,11 @@ def load_yaml(fname, args={}): except loader.yaml.YAMLError as exc: _LOGGER.error(str(exc)) raise HomeAssistantError(exc) - except UnicodeDecodeError as exc: + except (UnicodeDecodeError, FileNotFoundError) as exc: _LOGGER.error("Unable to read file %s: %s", fname, exc) raise HomeAssistantError(exc) + def _include_yaml(ldr, node): args = {} if isinstance(node.value, str):