Skip to content
Snippets Groups Projects
Unverified Commit d6fa4de4 authored by Justin Hynes's avatar Justin Hynes Committed by GitHub
Browse files

Merge pull request #26632 from edx/jhynes/log_exception_awarding_prog_certs

Log error when failing to award program certificate
parents d4ab4d45 03d788fc
Branches
Tags
No related merge requests found
......@@ -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:
......
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment