-
Notifications
You must be signed in to change notification settings - Fork 215
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
Subclass SchemaError for default errors such as 'Wrong keys', 'Missing keys' 'Wrong Type' #111
Comments
As long as these exceptions inherit from |
As long as we do not change the error message we should be OK. This should allow developers to catch specific exception and re-throw them when using this library in the application code. |
Might be worth adding these new type in the README.md do you agree ? |
Yes :( I forgot about that and already released 0.6.2... Would you like to do the honours of documenting the errors? |
I would like to suggest a simple change that would see the introduction of some new Error/Exception derived from SchemaError which would serve the purpose.
As of verson 0.6.1:
raise SchemaError('Wrong keys %s in %r' % (s_wrong_keys, data), e.format(data) if e else None)
raise SchemaError('Missing keys: ' + s_missing_keys, e)
SchemaError('%r should be instance of %r' % (data, s.__name__), e.format(data) if e else None)
into
class SchemaWrongKeyError(SchemaError):
class
SchemaMissingkeysError(SchemaError):class SchemaUnexpectedTypeError
(SchemaError)Thanks
The text was updated successfully, but these errors were encountered: