summaryrefslogtreecommitdiff
path: root/kvmd/yamlconf
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-09-18 04:37:43 +0300
committerMaxim Devaev <[email protected]>2024-09-18 04:37:43 +0300
commit7a53f1445619fc471c2823e7081de8b6039b938e (patch)
tree961dd0072cc976504fe4570743d801c79512e9a6 /kvmd/yamlconf
parent45270a09d7b5076bac96887a1e36d752882e3adf (diff)
refactoring
Diffstat (limited to 'kvmd/yamlconf')
-rw-r--r--kvmd/yamlconf/__init__.py8
-rw-r--r--kvmd/yamlconf/loader.py4
2 files changed, 6 insertions, 6 deletions
diff --git a/kvmd/yamlconf/__init__.py b/kvmd/yamlconf/__init__.py
index 42a69cfa..7cd3808d 100644
--- a/kvmd/yamlconf/__init__.py
+++ b/kvmd/yamlconf/__init__.py
@@ -143,8 +143,8 @@ class Option:
def manual_validated(value: Any, *path: str) -> Generator[None, None, None]:
try:
yield
- except (TypeError, ValueError) as err:
- raise ConfigError(f"Invalid value {value!r} for key {'/'.join(path)!r}: {err}")
+ except (TypeError, ValueError) as ex:
+ raise ConfigError(f"Invalid value {value!r} for key {'/'.join(path)!r}: {ex}")
def make_config(raw: dict[str, Any], scheme: dict[str, Any], _keys: tuple[str, ...]=()) -> Section:
@@ -185,8 +185,8 @@ def make_config(raw: dict[str, Any], scheme: dict[str, Any], _keys: tuple[str, .
else:
try:
value = option.type(value)
- except (TypeError, ValueError) as err:
- raise ConfigError(f"Invalid value {value!r} for key {make_full_name(key)!r}: {err}")
+ except (TypeError, ValueError) as ex:
+ raise ConfigError(f"Invalid value {value!r} for key {make_full_name(key)!r}: {ex}")
config[key] = value
config._set_meta( # pylint: disable=protected-access
diff --git a/kvmd/yamlconf/loader.py b/kvmd/yamlconf/loader.py
index 215cb526..5f879354 100644
--- a/kvmd/yamlconf/loader.py
+++ b/kvmd/yamlconf/loader.py
@@ -40,9 +40,9 @@ def load_yaml_file(path: str) -> Any:
with open(path) as file:
try:
return yaml.load(file, _YamlLoader)
- except Exception as err:
+ except Exception as ex:
# Reraise internal exception as standard ValueError and show the incorrect file
- raise ValueError(f"Invalid YAML in the file {path!r}:\n{tools.efmt(err)}") from None
+ raise ValueError(f"Invalid YAML in the file {path!r}:\n{tools.efmt(ex)}") from None
# =====