diff --git a/commerce_coordinator/apps/lms/tasks.py b/commerce_coordinator/apps/lms/tasks.py index 2bf226886..7fe29b331 100644 --- a/commerce_coordinator/apps/lms/tasks.py +++ b/commerce_coordinator/apps/lms/tasks.py @@ -45,9 +45,13 @@ def on_failure(self, exc, task_id, args, kwargs, einfo): f"Order Number: {order_number}, Course Title: {course_title}" ) + # This error is returned from LMS if the course mode is unsupported + # https://github.com/openedx/edx-platform/blob/master/openedx/core/djangoapps/enrollments/views.py#L870 + course_mode_expired_error = "course mode is expired or otherwise unavailable for course run" + if ( self.request.retries >= self.max_retries - and "course mode is expired or otherwise unavailable for course run" in error_message + and course_mode_expired_error in error_message ): logger.info(