feat: display detailed error message for 403 catalog visibility errors
This commit is contained in:
committed by
Adolfo R. Brandes
parent
2c9a5d09d7
commit
d77f39fbdb
@@ -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 }));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user