Skip to content

[ENG-8193] Fix issues with Preprint submission via API #11185

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

Open
wants to merge 2 commits into
base: feature/pbs-25-10
Choose a base branch
from

Conversation

antkryt
Copy link
Contributor

@antkryt antkryt commented Jun 16, 2025

Purpose

handle django core ValidationError in drf view

Changes

QA Notes

Documentation

Side Effects

Ticket

https://openscience.atlassian.net/browse/ENG-8193

Copy link
Collaborator

@brianjgeiger brianjgeiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you unit test this and verify that the situation in the ticket raises a 400 error rather than having an uncaught exception? Also, is every exception at this point going to be a DjangoValidationError, or are there any other errors possible at this point, like Conflicts or JSONAPIAttributeExceptions?

@antkryt
Copy link
Contributor Author

antkryt commented Jun 18, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants