Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve validation error presentation for invalid architectures in project models #629

Open
mr-cal opened this issue Jan 31, 2025 · 3 comments · May be fixed by canonical/craft-platforms#98
Labels
Enhancement New feature or request

Comments

@mr-cal
Copy link
Contributor

mr-cal commented Jan 31, 2025

What needs to get done

Change this error from:

Bad charmcraft.yaml content:
- 'amd65' is not a valid DebianArchitecture (in field 'platforms.jammy.build-on')

to:

Bad charmcraft.yaml content:
- 'amd65' is not a valid architecture (in field 'platforms.jammy.build-on')

This comes from unpacking an enum in:
https://github.com/canonical/craft-platforms/blob/main/craft_platforms/_architectures.py#L101

Which is used during validation in:

[craft_platforms.parse_base_and_architecture(arch) for arch in values]

In that validator, the ValueError can be caught, reworded, and re-raised.

Why it needs to get done

To provide more user-friendly errors.

@mr-cal
Copy link
Contributor Author

mr-cal commented Jan 31, 2025

pinging @tigarmo, if you have any opinion on the wording

@tigarmo
Copy link
Contributor

tigarmo commented Jan 31, 2025

what if we did this in craft-platforms instead?

@mr-cal
Copy link
Contributor Author

mr-cal commented Jan 31, 2025

How about canonical/craft-platforms#98 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants