Repository navigation
Conversation
fill_and_persist raised a plain FileNotFoundError, so /forms/fill answered 500 FORM_FILL_ERROR and async jobs recorded TASK_FAILED. Raise an AppError naming the template and path instead. Fixes fireform-core#757
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #757
Problem
When a template's PDF is no longer on disk,
FormService.fill_and_persistraised a plainFileNotFoundError. As a result:POST /forms/fillreturned 500FORM_FILL_ERRORand logged a traceback.TASK_FAILED.Change
app/services/form.py: raiseAppErrorwith 404TEMPLATE_PDF_NOT_FOUND. Thedetailfield has{template_id, pdf_path}.is_file(), so a path that points to a folder is caught here too.AppError, and the Celery task already recordsAppErrorcodes, so neither needed changes.contracts/path/forms.yaml: the 404 response for/forms/fillnow lists the new code.Tests
test_fill_form_template_file_not_foundnow expects the 404 and itsdetail, and checks thatfiller.fillis never called.test_task_records_missing_template_pdfrunsfill_form_taskin-process and checks that the job row storesTEMPLATE_PDF_NOT_FOUND.Both tests fail on
development(500FORM_FILL_ERROR/TASK_FAILED). With this change, the full suite passes (414) andruff check app/is clean.