Skip to content

Commit

Permalink
use Problem.translate
Browse files Browse the repository at this point in the history
  • Loading branch information
sadiqkhoja committed Dec 5, 2024
1 parent 8656c61 commit f6cd553
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/resources/submissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,9 @@ module.exports = (service, endpoint) => {
Forms.getBinaryFields(form.def.id)
])
.then(([ saved, binaryFields ]) => SubmissionAttachments.create(saved, form, binaryFields, files))
.catch((error) => {
// This is only true when submission is soft deleted, if it is hard deleted then there will no error
// and if it is not deleted then `extant` will be not null and this block will not execute.
if (error.isProblem === true && error.problemCode === 409.3) {
throw Problem.user.duplicateSubmission();
}
throw error;
});
// This is only true when submission is soft deleted, if it is hard deleted then there will no error
// and if it is not deleted then `extant` will be not null and this block will not execute.
.catch(Problem.translate(Problem.user.uniquenessViolation, noargs(Problem.user.duplicateSubmission)));
});
})
.then(always(createdMessage({ message: 'full submission upload was successful!' }))))));
Expand Down

0 comments on commit f6cd553

Please sign in to comment.