From: Aleš Mrázek Date: Mon, 24 Jul 2023 21:36:19 +0000 (+0200) Subject: datamodel: types: verbose errors for paths X-Git-Tag: v6.0.2~25^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ff2c8e09ee1424ae2833b5a9101292a83423771;p=thirdparty%2Fknot-resolver.git datamodel: types: verbose errors for paths --- diff --git a/manager/knot_resolver_manager/datamodel/types/files.py b/manager/knot_resolver_manager/datamodel/types/files.py index 99fd8c21f..6244a6d37 100644 --- a/manager/knot_resolver_manager/datamodel/types/files.py +++ b/manager/knot_resolver_manager/datamodel/types/files.py @@ -101,7 +101,7 @@ class AbsoluteDir(Dir): ) -> None: super().__init__(source_value, parents=parents, object_path=object_path) if self.strict_validation and not self._value.is_absolute(): - raise ValueError("path not absolute") + raise ValueError(f"path '{self._value}' is not absolute") class File(UncheckedPath): @@ -115,9 +115,9 @@ class File(UncheckedPath): ) -> None: super().__init__(source_value, parents=parents, object_path=object_path) if self.strict_validation and not self._value.exists(): - raise ValueError("file does not exist") + raise ValueError(f"file '{self._value}' does not exist") if self.strict_validation and not self._value.is_file(): - raise ValueError("path is not a file") + raise ValueError(f"path '{self._value}' is not a file") class FilePath(UncheckedPath): @@ -135,4 +135,4 @@ class FilePath(UncheckedPath): if self.strict_validation and not p.exists() or not p.is_dir(): raise ValueError(f"path '{self._value}' does not point inside an existing directory") if self.strict_validation and self._value.is_dir(): - raise ValueError("path points to a directory when we expected a file") + raise ValueError(f"path '{self._value}' points to a directory when we expected a file")