diff --git a/backend/src/components/sdc/sdc.js b/backend/src/components/sdc/sdc.js index 64ef6ec2..2d0aaf38 100644 --- a/backend/src/components/sdc/sdc.js +++ b/backend/src/components/sdc/sdc.js @@ -682,11 +682,8 @@ async function updateAndValidateSdcSchoolCollectionStudent(req, res) { status: HttpStatus.CONFLICT, message: 'The student you are attempting to update is already being saved by another user. Please refresh your screen and try again.' }); - } else if (e.status === 400 && e.data.message === 'SdcSchoolCollectionStudent was not saved to the database because it would create a provincial duplicate.') { - return res.status(HttpStatus.CONFLICT).json({ - status: HttpStatus.CONFLICT, - message: 'Student was not saved because it would create provincial a duplicate.' - }); + } else if (e?.status === 400) { + return res.status(HttpStatus.BAD_REQUEST).json(e?.data?.message); } return handleExceptionResponse(e, res); } diff --git a/frontend/src/components/data-collection/AllStudents/EditStudent.vue b/frontend/src/components/data-collection/AllStudents/EditStudent.vue index 300544ff..6ed1657f 100644 --- a/frontend/src/components/data-collection/AllStudents/EditStudent.vue +++ b/frontend/src/components/data-collection/AllStudents/EditStudent.vue @@ -764,7 +764,7 @@ export default { } }).catch(error => { console.error(error); - setFailureAlert(error?.response?.data?.message ? error?.response?.data?.message : 'An error occurred while trying to update student details. Please try again later.'); + setFailureAlert(error?.response?.data ? error?.response?.data : 'An error occurred while trying to update student details. Please try again later.'); }).finally(() => { this.loadingCount -= 1; this.$emit('reset-parent');