Skip to content

Commit

Permalink
fix: Better error messages for yaml validation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
FHeilmann committed Jan 9, 2024
1 parent 2d60a39 commit 763ee6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion voron_toolkit/tools/mod_structure_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions voron_toolkit/tools/readme_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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,
),
)
Expand Down

0 comments on commit 763ee6e

Please sign in to comment.