-
Notifications
You must be signed in to change notification settings - Fork 31
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
Way to redefine error messages #48
Comments
U can redefine base clases. class MyBool(t.Bool):
def check_value(self, value):
if not isinstance(value, bool):
self._failure("My custom error", value=value)
MyBool().check(True) or user def not_some_validator(value):
if value == "some":
return t.DataError('My custom error.')
return value
t.Call(not_some_validator).check("some") I'm not sure what is the best way but it's not look like "kostyls" |
I need some time to figure out proper way. |
а можна ли разширить так чтобы все текста ошибок можна было переопределять? |
можно, на выходных постараюсь сделать |
Привет, это еще актуально? Тоже интересует .. |
In version2 DataError has |
I have a scheme of t.Dict with several fields. I want when required field is absent to replace default error string. What is the best way to do it? without kostyls...
The text was updated successfully, but these errors were encountered: