summaryrefslogtreecommitdiff
path: root/kvmd/yamlconf/loader.py
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/yamlconf/loader.py')
-rw-r--r--kvmd/yamlconf/loader.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/kvmd/yamlconf/loader.py b/kvmd/yamlconf/loader.py
index 20ff7c93..2acff93f 100644
--- a/kvmd/yamlconf/loader.py
+++ b/kvmd/yamlconf/loader.py
@@ -28,15 +28,17 @@ from typing import Any
import yaml
import yaml.nodes
+from .. import tools
+
# =====
def load_yaml_file(path: str) -> Any:
with open(path) as yaml_file:
try:
return yaml.load(yaml_file, _YamlLoader)
- except Exception:
+ except Exception as err:
# Reraise internal exception as standard ValueError and show the incorrect file
- raise ValueError(f"Incorrect YAML syntax in file {path!r}")
+ raise ValueError(f"Invalid YAML in the file {path!r}:\n{tools.efmt(err)}") from None
class _YamlLoader(yaml.SafeLoader):