Skip to content
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

catch RIS import errors with form validation #647

Merged
merged 5 commits into from
Jul 20, 2022
Merged

Conversation

shapiromatron
Copy link
Owner

@shapiromatron shapiromatron commented Jul 12, 2022

RIS files are messy and if improperly formatted, can lead to a bad import into HAWC. In most cases, our import form properly validates the RIS file and returns errors to the user. However, in a few edge cases (where a year is an empty string), the RIS passes validation, but then throws an error when we attempt to import references. This work properly tries to more strictly validate the file and pass exceptions to users.

We also did a little rewriting of tests, and standardized where the cleaning is done. Leaning on conventions with pydantic, our importer throws ValueError, and if found are caught by the form and cast as a ValidationError.

@shapiromatron shapiromatron changed the title WIP: RIS error catching catch RIS import errors with form validation Jul 12, 2022
@shapiromatron shapiromatron requested a review from caseyhans July 12, 2022 19:31
Copy link
Collaborator

@caseyhans caseyhans left a comment

Choose a reason for hiding this comment

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

Nice, cuts down on the code a bit :)

@shapiromatron shapiromatron merged commit b735295 into main Jul 20, 2022
@shapiromatron shapiromatron deleted the ris-error-catching branch July 20, 2022 18:23
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