From cd1e98bcf5c838c08c10b45fef670cf5a214345c Mon Sep 17 00:00:00 2001 From: mubbsharanwar Date: Tue, 26 Nov 2024 14:00:19 +0500 Subject: [PATCH] fix: update loging message update loging message copy by adding exception message for debugging SONIC-794 --- commerce_coordinator/apps/lms/clients.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commerce_coordinator/apps/lms/clients.py b/commerce_coordinator/apps/lms/clients.py index 6e9d06757..4640957b0 100644 --- a/commerce_coordinator/apps/lms/clients.py +++ b/commerce_coordinator/apps/lms/clients.py @@ -1,6 +1,8 @@ """ API clients for LMS app. """ +import json as Json + from celery.utils.log import get_task_logger from django.conf import settings from requests.exceptions import RequestException @@ -119,7 +121,8 @@ def post(self, url, json, line_item_state_payload, logging_obj, timeout=None): **fulfill_line_item_state_payload ) logger.info( - f"Unsuccessful fulfillment for user: {logging_obj['user']} with details: " + f"Unsuccessful fulfillment for user: {logging_obj['user']} " + f"due to {Json.loads(exc.response.text).get('message')} with details: " f"[lms user id: {logging_obj['lms_user_id']}, order id: {logging_obj['order_id']}, " f"course id: {logging_obj['course_id']}, message_id: {logging_obj['message_id']}, " f"celery_task_id: {logging_obj['celery_task_id']}]"