canonical / rockcraft

Tool to create OCI Images using the language from Snapcraft and Charmcraft.
GNU General Public License v3.0
25 stars 33 forks source link

fix: don't raise CraftValidationErrors in validators #600

Closed tigarmo closed 1 week ago

tigarmo commented 1 week ago

The rule is this: in validators, always raise the types that Pydantic expects (ValueErrors, AssertionErrors, TypeError, and subclasses of these). This allows Pydantic to capture all errors and group them into a single ValidationError, which we can then convert into a single CraftValidationError in from_yaml_data(). This provides a more uniform UI for the reporting of validation errors on the project.