-
Notifications
You must be signed in to change notification settings - Fork 39
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
Subclassing errors from ValidationError #51
Comments
I have working implementation of this here - https://gist.github.com/floatdrop/11de8d9de827f8ac11c1a1ae8260ccbd It contains solution for this issue, #8, #29 and #48, but changes behaviour significantly (for example – all checks are now failing fast and running in order). Downside of defining error type is more added code to constraints. But it could be sorted with specialized overloads for |
Interesting, I will check out your changes to see if there is anything worthwhile
|
Not going to consider this at this time. Adding a generic type parameter to Validation would be a massive breaking change and a large change to the API. I do see some of the problems this is trying to solve, but I don't think subclassing the validation result should be a goal in itself, and don't think this proposal is the right way to go about it. |
Sometimes we need to attach additional meta-data to validation results (#48) and perform custom l10n for message (#2). Both tasks fits nicely into custom ValidationError types (also it is quite handy to get all possible error types for validation).
I have something like this in mind:
Maybe there is a cleaner way to achieve this in DSL (for example - avoid overloading ValidationBuilder with custom validations).
The text was updated successfully, but these errors were encountered: