Refactor error handling in Preservation Submission Job #1250
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.
Why these changes are being introduced:
The Preservation Submission Job currently handles exceptions during SIP creation by setting the SIP's status to 'error' and saving it. This allows us to see failed SIPs in the administrate dashboard, but it also causes preservation to fail silently.
Relevant ticket(s):
https://mitlibraries.atlassian.net/browse/ETD-647
How this addresses that need:
This refactors the Preservation Submission Job to create SIPs using
create!
instead ofcreate
, so that exceptions are raised during the object creation. When exceptions are raised, they are logged and added to theresults
array. Since no SIP is created when an exception is raised bycreate!
, the logic in therescue
block around updatingpreservation_status
has been removed.Side effects of this change:
preservation_status
of 'error' has been removed, as it is no longer used in the app. There are currently no SIPs in production that have this status.baggable
module has been moved fromapp/models
toapp/lib
. This to be consistent with where we store our other module, and to make it clear that it is not a model.Developer
our guide and
all issues introduced by these changes have been resolved or opened as new
issues (link to those issues in the Pull Request details above)
Code Reviewer
(not just this pull request message)
Requires database migrations?
NO
Includes new or updated dependencies?
NO