Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: #6087 Display specific error message for course slug collision (revision) #6168

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ichandrasharma
Copy link

@ichandrasharma ichandrasharma commented Feb 1, 2025

What this PR does

(Revision)
Fixes #6087

This PR addresses the issue where a generic "Internal Server Error" message was displayed when a user attempted to change a course slug to one that already existed.

Screenshots

Before:

This is an error occurring not showing proper message only showing Internal Server Error
Screenshot (69)

Course titles can be identical for different organizations or institutions, but must be unique within the same organization or institution. This is because course titles are used to dynamically generate URLs (slugs), and duplicate titles within the same organization would create URL conflicts.
look: below
Screenshot (70)

After:

Showing proper message
Updated
Screenshot (75)
Screenshot (76)

@@ -321,6 +321,10 @@ const API = {
});

if (!response.ok) {
if (response.status === 422 || response.status === 400) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than special handling in JS, this should follow the pattern used elsewhere in the app where the message from the JSON error response shown, rather than a message that is part of frontend code.

See assignments_controller.rb for some examples of this pattern, or the PR that fixed another instance of this sort of issue: #1760

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ragesoss I've made the changes you can check them. Now, the backend dynamically returns JSON error responses in all supported languages based on the selected language. I’ve also updated the screenshots for your review. Let me know if you have any feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error message from course slug collision does not explain the problem
2 participants