diff --git a/lms/services/exceptions.py b/lms/services/exceptions.py index aff755f6e2..764f235981 100644 --- a/lms/services/exceptions.py +++ b/lms/services/exceptions.py @@ -264,8 +264,8 @@ def __init__( class FileNotFoundInCourse(SerializableError): """A file wasn't found in the current course.""" - def __init__(self, error_code: str, file_id): - super().__init__(error_code=error_code, details={"file_id": file_id}) + def __init__(self, error_code: str, document_id): + super().__init__(error_code=error_code, details={"document_id": document_id}) class StudentNotInCourse(SerializableError): diff --git a/lms/static/scripts/frontend_apps/components/LaunchErrorDialog.tsx b/lms/static/scripts/frontend_apps/components/LaunchErrorDialog.tsx index 9ed72841be..55bf424238 100644 --- a/lms/static/scripts/frontend_apps/components/LaunchErrorDialog.tsx +++ b/lms/static/scripts/frontend_apps/components/LaunchErrorDialog.tsx @@ -212,6 +212,21 @@ export default function LaunchErrorDialog({ ); + case 'canvas_page_not_found_in_course': + return ( + +

This might have happened because:

+ + +
+ ); + case 'canvas_group_set_not_found': return ( { hasRetry: true, withError: true, }, + { + errorState: 'canvas_page_not_found_in_course', + expectedText: 'The page has been deleted from Canvas', + expectedTitle: "Hypothesis couldn't find the page in the course", + hasRetry: true, + withError: true, + }, { errorState: 'd2l_file_not_found_in_course_instructor', expectedText: diff --git a/lms/static/scripts/frontend_apps/errors.ts b/lms/static/scripts/frontend_apps/errors.ts index 3075d1f5fa..76c1a888ab 100644 --- a/lms/static/scripts/frontend_apps/errors.ts +++ b/lms/static/scripts/frontend_apps/errors.ts @@ -9,18 +9,19 @@ export type LTILaunchServerErrorCode = | 'blackboard_group_set_empty' | 'blackboard_group_set_not_found' | 'blackboard_student_not_in_group' - | 'd2l_file_not_found_in_course_student' - | 'd2l_file_not_found_in_course_instructor' - | 'd2l_group_set_not_found' - | 'd2l_group_set_empty' - | 'd2l_student_not_in_group' | 'canvas_api_permission_error' | 'canvas_file_not_found_in_course' - | 'canvas_group_set_not_found' | 'canvas_group_set_empty' + | 'canvas_group_set_not_found' + | 'canvas_page_not_found_in_course' | 'canvas_student_not_in_group' - | 'vitalsource_user_not_found' - | 'vitalsource_no_book_license'; + | 'd2l_file_not_found_in_course_instructor' + | 'd2l_file_not_found_in_course_student' + | 'd2l_group_set_empty' + | 'd2l_group_set_not_found' + | 'd2l_student_not_in_group' + | 'vitalsource_no_book_license' + | 'vitalsource_user_not_found'; /** * An `Error` or error-like object. This allows components in the application @@ -149,6 +150,7 @@ export function isLTILaunchServerError(error: ErrorLike): error is APIError { 'd2l_student_not_in_group', 'canvas_api_permission_error', 'canvas_file_not_found_in_course', + 'canvas_page_not_found_in_course', 'canvas_group_set_not_found', 'canvas_group_set_empty', 'canvas_student_not_in_group', diff --git a/lms/static/scripts/ui-playground/components/ErrorComponents.tsx b/lms/static/scripts/ui-playground/components/ErrorComponents.tsx index b9733a77fe..578d710f39 100644 --- a/lms/static/scripts/ui-playground/components/ErrorComponents.tsx +++ b/lms/static/scripts/ui-playground/components/ErrorComponents.tsx @@ -446,6 +446,7 @@ export default function ErrorComponents() { [ 'canvas_api_permission_error', 'canvas_file_not_found_in_course', + 'canvas_page_not_found_in_course', 'canvas_group_set_not_found', 'canvas_group_set_empty', 'canvas_student_not_in_group', diff --git a/tests/unit/lms/views/api/d2l/files_test.py b/tests/unit/lms/views/api/d2l/files_test.py index 5eea687534..85fdcea182 100644 --- a/tests/unit/lms/views/api/d2l/files_test.py +++ b/tests/unit/lms/views/api/d2l/files_test.py @@ -99,7 +99,7 @@ def test_it_when_file_not_in_course( ): course_copy_plugin.is_file_in_course.return_value = False d2l_api_client.public_url.side_effect = FileNotFoundInCourse( - "d2l_file_not_found_in_course_instructor", file_id="FILE_ID" + "d2l_file_not_found_in_course_instructor", document_id="FILE_ID" ) course_copy_plugin.find_matching_file_in_course.return_value = None