diff --git a/openedx/core/djangoapps/programs/tasks.py b/openedx/core/djangoapps/programs/tasks.py index c80ec6d2f41c96c568074a3934c997790fe29767..8183dc469ad77908057506033bc1d55037a30255 100644 --- a/openedx/core/djangoapps/programs/tasks.py +++ b/openedx/core/djangoapps/programs/tasks.py @@ -255,9 +255,9 @@ def award_program_certificates(self, username): # lint-amnesty, pylint: disable f"Unable to award certificate to user {username} for program {program_uuid}. " "The program might not be configured." ) - except Exception: # pylint: disable=broad-except + except Exception as exc: # pylint: disable=broad-except # keep trying to award other certs, but retry the whole task to fix any missing entries - LOGGER.warning(f"Failed to award certificate for program {program_uuid} to user {username}.") + LOGGER.exception(f"Failed to award certificate for program {program_uuid} to user {username}.") failed_program_certificate_award_attempts.append(program_uuid) if failed_program_certificate_award_attempts: diff --git a/openedx/core/djangoapps/programs/tests/test_tasks.py b/openedx/core/djangoapps/programs/tests/test_tasks.py index e22a3efb0b6cce5cf53d4288016df85b59c21b5c..70256522e6a6e06dafdeb3e4a549929a69b6e368 100644 --- a/openedx/core/djangoapps/programs/tests/test_tasks.py +++ b/openedx/core/djangoapps/programs/tests/test_tasks.py @@ -343,7 +343,7 @@ class AwardProgramCertificatesTestCase(CatalogIntegrationMixin, CredentialsApiCo mock_award_program_certificate.side_effect = self._make_side_effect([Exception('boom'), None]) with mock.patch(TASKS_MODULE + '.LOGGER.info') as mock_info, \ - mock.patch(TASKS_MODULE + '.LOGGER.warning') as mock_warning: + mock.patch(TASKS_MODULE + '.LOGGER.exception') as mock_warning: tasks.award_program_certificates.delay(self.student.username).get() assert mock_award_program_certificate.call_count == 3