Skip to content

Commit

Permalink
fixup! fix: don't raise CraftValidationErrors in validators
Browse files Browse the repository at this point in the history
  • Loading branch information
tigarmo committed Jun 21, 2024
1 parent 73806b6 commit 445e6cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions rockcraft/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ def _validate_all_platforms(cls, platforms: dict[str, Any]) -> dict[str, Any]:
try:
platform = Platform(**platform).dict()
except pydantic.ValidationError as err:
errors = []
for err_dict in err.errors():
errors.append(err_dict["msg"])
errors = [err_dict["msg"] for err_dict in err.errors()]
full_errors = ",".join(errors)
raise ValueError(f"{error_prefix}: {full_errors}") from None

Expand Down
2 changes: 1 addition & 1 deletion tests/spread/rockcraft/invalid-name/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ execute: |
for name in a_a a@a a--a aa-
do
sed "s/placeholder-name/$name/" rockcraft.orig.yaml > rockcraft.yaml
rockcraft pack 2>&1 >/dev/null | MATCH "Invalid name for rock"
rockcraft pack 2>&1 >/dev/null | MATCH "invalid name for rock"
done

0 comments on commit 445e6cc

Please sign in to comment.