osf.io
osf.io copied to clipboard
[ENG-8193] Fix issues with Preprint submission via API
Purpose
handle django core ValidationError in drf view
Changes
QA Notes
Documentation
Side Effects
Ticket
https://openscience.atlassian.net/browse/ENG-8193
Any raised exceptions from rest_framework.exceptions (like Conflict, NotFound, ValidationError, etc.) are going to be handled by DRF and return appropriate status code. I've added unit tests to test 400 and 409, also added handling for ValueError. All other exceptions are not expected here I think, so they should return 500
JSONAPIAttributeExceptions and similar are going to be handled by our custom exception handler