diff options
author | Devaev Maxim <[email protected]> | 2021-04-17 17:44:48 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-04-17 17:44:48 +0300 |
commit | 19c4c7d1e3f11e1682c72336df06426d9b7608a5 (patch) | |
tree | 14fad7f5b75714152e8ce7f07ae0654c0a83ebb5 /kvmd/apps/__init__.py | |
parent | 5dea266895f2dac364e81e83e5ef635d1b8c1466 (diff) |
clean yaml error message
Diffstat (limited to 'kvmd/apps/__init__.py')
-rw-r--r-- | kvmd/apps/__init__.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index cb5666b9..c807858f 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -161,9 +161,12 @@ def init( # ===== def _init_config(config_path: str, override_options: List[str], **load_flags: bool) -> Section: config_path = os.path.expanduser(config_path) - raw_config: Dict = load_yaml_file(config_path) + try: + raw_config: Dict = load_yaml_file(config_path) + except Exception as err: + raise SystemExit(f"ConfigError: Can't read config file {config_path!r}:\n{tools.efmt(err)}") if not isinstance(raw_config, dict): - raise SystemExit(f"Config error: Top-level of the file {config_path!r} must be a dictionary") + raise SystemExit(f"ConfigError: Top-level of the file {config_path!r} must be a dictionary") scheme = _get_config_scheme() try: @@ -177,7 +180,7 @@ def _init_config(config_path: str, override_options: List[str], **load_flags: bo return config except (ConfigError, UnknownPluginError) as err: - raise SystemExit(f"Config error: {err}") + raise SystemExit(f"ConfigError: {err}") def _patch_raw(raw_config: Dict) -> None: |