Open codeforcesmeme opened 1 week ago
@ghazi-git correct me if I'm wrong. @codeforcesmeme The problem looks like a Django core ValidationError
is being raise rather than a DRF ValidationError
, hence why it's not handling the exception. Was DRF catching the Django core exception previously?
@GiancarloFusiello Thank you!! that's exactly it! Silly thing I missed it since I am not the one who wrote the code but had to deal with this after tests failing when I integrated drf-standardized-errors
. Answering your question, yes it was handled before with vanilla DRF.
I will leave the ticket up to the maintainers if they think code validation exceptions should be handled as well or not, otherwise, feel free to close it.
@codeforcesmeme happy to help. FWIW, looking at DRF exception_handler it doesn't look like Django core validation errors are handled directly.
I have got a semi-complex case of model inheritance and need to do some validation check on instance update/create and the best way for me to avoid duplication is to put it in the model clean (one shared at the top abstract parent) and others optional at the children, just to avoid some big code duplications on the serializer level per polymorphic child etc..
This worked flawlessly before but since integrating drf-standardized-errors I've been getting the following error trace of internal error with no easy way to grasp what's happening because I can't tell which function called from DRF is being masked from this package.
Full trace: