From 763ee6ec891c6a4be51fa6f2aa000c84a8cf923d Mon Sep 17 00:00:00 2001 From: Florian Heilmann Date: Tue, 9 Jan 2024 01:22:15 +0100 Subject: [PATCH] fix: Better error messages for yaml validation errors --- voron_toolkit/tools/mod_structure_checker.py | 2 +- voron_toolkit/tools/readme_generator.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/voron_toolkit/tools/mod_structure_checker.py b/voron_toolkit/tools/mod_structure_checker.py index b435c84..fbfc0eb 100644 --- a/voron_toolkit/tools/mod_structure_checker.py +++ b/voron_toolkit/tools/mod_structure_checker.py @@ -114,7 +114,7 @@ def _validate_metadata_file(self: Self, schema: dict[str, Any], mod_folder: Path self.result_items[ExtendedResultEnum.FAILURE].append( ItemResult( item=Path(mod_folder, ".metadata.yml").relative_to(self.input_dir).as_posix(), - extra_info=[FileErrors.mod_has_invalid_metadata_file.value], + extra_info=[e.message], ) ) self.all_results.append(ExtendedResultEnum.FAILURE) diff --git a/voron_toolkit/tools/readme_generator.py b/voron_toolkit/tools/readme_generator.py index 6d30e3e..92dcb01 100644 --- a/voron_toolkit/tools/readme_generator.py +++ b/voron_toolkit/tools/readme_generator.py @@ -49,7 +49,7 @@ def run(self: Self) -> None: metadata: dict[str, Any] = yaml.safe_load(yml_file.read_text()) jsonschema.validate(instance=metadata, schema=schema) except (yaml.YAMLError, yaml.scanner.ScannerError) as e: - logger.error("YAML error in metadata file of mod '{}': {}", mod_path, e) + logger.error("YAML parsing error in metadata file of mod '{}': {}", mod_path, e) result = ExtendedResultEnum.FAILURE self.result_items[ExtendedResultEnum.FAILURE].append( ItemResult( @@ -73,7 +73,7 @@ def run(self: Self) -> None: self.result_items[ExtendedResultEnum.FAILURE].append( ItemResult( item=mod_path, - extra_info=["Error validating yaml file", ""], + extra_info=["Error validating yaml file", e.message], ) ) mods.append( @@ -145,7 +145,7 @@ def run(self: Self) -> None: extended_result=result, tool_ignore_warnings=False, tool_result_items=ToolSummaryTable( - extra_columns=["Description/Error", "Printer compatibility"], + extra_columns=["Description/Error", "Printer compatibility/Error Detail"], items=self.result_items, ), )