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
Allow to pass error-handlers to a Validator
-instance
#93
Comments
i'm willing to implement this, but will complete other TODOs before. any feedback is appreciated. |
I think this is a great idea. I am using YAML to display error messages in my application, it is just a lot simpler to see what the problem is. |
Like it. Scheduling for 0.10 release. |
i'm currently working on that whenever i have the time and hope to provide a peek on wip this week (next week i'll be abroad). |
closing this as the core interface is now available. |
Is |
this is a follow-up to #89 and #90.
i propose to introduce error-handlers in order to allow to deal with errors more flexible.
to achieve that:
Validator.__init__
takes an optionalerror_handler
-objectValidator._error
is extended, so it stores the following data about an error:trail
- a list that represents the path to thefield
in the document (eg:['a_dict', 'a_list']
); a common prefix can be specified upon callingValidator.validate
field
,value
- as of nowconstraint
- the constraint that failedmessage
- a simple error message, like currently implementedValidator.errors
calls theformat
(?)-method oferror_handler
that may return errors in a desired format and / or do whatever its purpose isthere will be one default-handler and two as reference-implementations:
BasicErrorHandler
trail
andfield
HumanReadableErrorHandler
trail
andfield
item #
YamlErrorHandler
The text was updated successfully, but these errors were encountered: