Add optional kwarg to serializer.is_valid method for passing custom api exception class #8384
Unanswered
serotonin276
asked this question in
Ideas & Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently we have same code value for all the validation errors, which is invalid. There is no way to pass in custom value, because the is_valid method of serializer internally raises the ValidationError exception. The method only passes detail after collecting all the validation error details. It would be nice if the method had a optional code kwarg defaulting to NoneSimilarly, there is no way, if we want to categorize and add more details to the ValidationError class.
Or add anSo I suggest to add an optional kwarg for passing a custom api exception class defaulting to the ValidationError class, so that users can construct their own error response for validation errors
Beta Was this translation helpful? Give feedback.
All reactions