feat: display detailed error message for 403 catalog visibility errors

This commit is contained in:
Muhammad Anas
2026-03-06 16:49:05 +05:00
committed by Adolfo R. Brandes
parent 2c9a5d09d7
commit d77f39fbdb
8 changed files with 130 additions and 3 deletions

View File

@@ -129,7 +129,17 @@ export function fetchCourse(courseId) {
}
// Definitely an error happening
dispatch(fetchCourseFailure({ courseId }));
// Extract error details from 403 responses
let errorMessage = null;
let errorCode = null;
if (!fetchedCourseHomeMetadata) {
const error = courseHomeMetadataResult.reason;
if (error?.response?.status === 403 && error?.response?.data) {
errorMessage = error.response.data.detail || null;
errorCode = error.response.data.error_code || null;
}
}
dispatch(fetchCourseFailure({ courseId, errorMessage, errorCode }));
});
};
}