Skip to content

Commit 309a7e6

Browse files
committed
Show dynamic error messages in frontend.
1 parent 4722f8f commit 309a7e6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

backend/server/controllers/courseinstances.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ module.exports = {
294294
message: 'You have not yet registered to this course at WebOodi. If you have already registered at WebOodi, try again in two hours.'
295295
})
296296
}
297-
298297
let student
299298
try {
300299
student = await StudentInstance.findOrCreate({
@@ -321,12 +320,13 @@ module.exports = {
321320
message: errorMessage.join('\n')
322321
})
323322
}
324-
return res.status(400).send({
325-
message: error.errors
323+
console.log('Unexpected error in registration.', error)
324+
return res.status(500).json({
325+
message: 'Unexpected error.'
326326
})
327327
}
328328
if (!student) {
329-
res.status(400).send({
329+
res.status(400).json({
330330
message: 'Student record could not be found or created.'
331331
})
332332
} else {

labtool2.0/src/reducers/notificationReducer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const notificationReducer = (state = {}, action) => {
4545
}
4646
case 'STUDENT_COURSE_CREATE_ONE_FAILURE':
4747
return {
48-
message: 'You have not yet registered to this course at WebOodi. If you have already registered at WebOodi, try again in two hours.',
48+
message: action.response.response.data.message,
4949
error: true
5050
}
5151
case 'CI_MODIFY_ONE_SUCCESS':

0 commit comments

Comments
 (0)