exception handling in slcManagement.js#1727
Conversation
Replaces silent console.log with an alert so the user is notified when a withdrawal fails. Also fixes done -> complete so the select reset actually runs.
ArtemKurasov
left a comment
There was a problem hiding this comment.
The warning seems to be displayed correctly
fritzj2
left a comment
There was a problem hiding this comment.
The warning appears to display correctly; however, it is confusing to read. Change it to an if/else statement for clarity. Check msgFlash() instead of alert for consistency across other files.
d1551aa
zhytkovd
left a comment
There was a problem hiding this comment.
The msgFlash message shows under the pop-up window
MImran2002
left a comment
There was a problem hiding this comment.
The issue has been fixed in the backend so all you would need to do is removed the console.log as the issue described because the error messaging is catching from the backend already so if there is an error it will be highlighted from the backend already. The request.response.message you implement can only work if the return from withdrawCourse return and error with a message only then the logic you wrote in the code will work.
So for now I would suggest you to remove the console.log.
…CStudentSoftwareDevTeam/celts into feitsopb_dee_exceptionhandling
BhushanSah
left a comment
There was a problem hiding this comment.
I tested this locally, and it works as expected.
The change improves the withdraw error handling by showing a user-facing flash message instead of only logging the error in the console. I also like that it checks for request.responseJSON.message and falls back to a clear default message when the server does not return one.
Using complete here also makes sense, since the dropdown reset should occur after the request finishes, whether it succeeds or fails.
No issues from my testing. Approved.
MImran2002
left a comment
There was a problem hiding this comment.
Have deleted the console.log, create the reload as Brian said and ensure http error code are part of the return
Issue Description
Fixes #1535
-The withdraw function in slcManagement.js was silently swallowing errors, so users had no way of knowing when a course withdrawal failed.
Changes
Added a user-facing alert in the error handler of the withdraw ajax request so the user is notified when something goes wrong.
Fixed done to complete so the select reset actually runs after the request finishes.
Testing
Open the Manage Service Learning page.
Select "Withdraw" on a course to trigger the withdraw modal.
Click the withdraw button while the server is unreachable or returning an error.
Confirm that an alert appears informing the user that the withdrawal failed instead of failing silently.