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

Consider an API which collects validation errors and raises an exception group #1011

Open
Julian opened this issue Oct 25, 2022 · 0 comments
Labels
Dialects v2 Issues which will likely be addressed as part of reworked dialect support Enhancement Some new desired functionality Error Reporting Issues related to clearer or more robust validation error reporting

Comments

@Julian
Copy link
Member

Julian commented Oct 25, 2022

Python 3.11 now supports exception groups for grouping together multiple (simultaneous, unrelated) exceptions.

This seems to suit us -- right now we have:

  • Validator.iter_errors, aimed at returning (not raising) all errors
  • Validator.is_valid, aimed at returning no errors and indicating via a boolean whether things are OK
  • Validator.validate, aimed at raising 1 single exception (the first encountered one)

Another API where we raise all exceptions iter_errors would have returned seems like it may fit the picture.

Reviewing the notes API to see if we should make any use of it is likely also wise.

@Julian Julian added the Enhancement Some new desired functionality label Oct 25, 2022
@Julian Julian added Dialects v2 Issues which will likely be addressed as part of reworked dialect support Error Reporting Issues related to clearer or more robust validation error reporting labels Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dialects v2 Issues which will likely be addressed as part of reworked dialect support Enhancement Some new desired functionality Error Reporting Issues related to clearer or more robust validation error reporting
Projects
None yet
Development

No branches or pull requests

1 participant