From 2692fde32e96faf8fb74df0b9f0b9072ffff1128 Mon Sep 17 00:00:00 2001 From: Syed Sajjad Hussain Shah Date: Tue, 3 Dec 2024 15:02:32 +0500 Subject: [PATCH] fix: handle review comments --- commerce_coordinator/apps/lms/tasks.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/commerce_coordinator/apps/lms/tasks.py b/commerce_coordinator/apps/lms/tasks.py index 2bf22688..ecf26669 100644 --- a/commerce_coordinator/apps/lms/tasks.py +++ b/commerce_coordinator/apps/lms/tasks.py @@ -3,7 +3,6 @@ """ import json - from datetime import datetime from celery import Task, shared_task @@ -45,9 +44,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(