Skip to content

Commit a935585

Browse files
authored
test: improve logging for periodic error (#35141)
we have a periodic error that makes no sense when the certificate available date is none. This improves logging for the API call. Because the only thing being changed is a course certificate, there is no risk of PII being exposed in the new logging.
1 parent 058870e commit a935585

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

  • openedx/core/djangoapps/programs

openedx/core/djangoapps/programs/tasks.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,16 @@ def post_course_certificate_configuration(client, cert_config, certificate_avail
235235
"""
236236
credentials_api_base_url = get_credentials_api_base_url()
237237
credentials_api_url = urljoin(f"{credentials_api_base_url}/", "course_certificates/")
238+
certificate_config = {
239+
"course_id": cert_config["course_id"],
240+
"certificate_type": cert_config["mode"],
241+
"certificate_available_date": certificate_available_date,
242+
"is_active": True,
243+
}
238244

239245
response = client.post(
240246
credentials_api_url,
241-
json={
242-
"course_id": cert_config["course_id"],
243-
"certificate_type": cert_config["mode"],
244-
"certificate_available_date": certificate_available_date,
245-
"is_active": True,
246-
},
247+
json=certificate_config,
247248
)
248249

249250
# Sometimes helpful error context is swallowed when calling `raise_for_status()`. We try to print out any additional
@@ -253,8 +254,8 @@ def post_course_certificate_configuration(client, cert_config, certificate_avail
253254
# 201 on a successful call.
254255
if response.status_code != 201:
255256
LOGGER.error(
256-
"Error creating or updating a course certificate configuration in the Credentials IDA. Additional details: "
257-
f"{response.text}"
257+
"Error creating or updating a course certificate configuration in the Credentials IDA.\n"
258+
f"config sent: {certificate_config}\nAdditional details: {response.text}"
258259
)
259260
response.raise_for_status()
260261

0 commit comments

Comments
 (0)