From 799feb36ab1dc66d3fd2720658c94eb040bcc8a9 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commerce_coordinator/apps/lms/clients.py b/commerce_coordinator/apps/lms/clients.py index 6e9d0675..3e4c1f22 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 @@ -118,8 +120,10 @@ def post(self, url, json, line_item_state_payload, logging_obj, timeout=None): sender=self.__class__, **fulfill_line_item_state_payload ) + error_message = Json.loads(exc.response.text).get('message') logger.info( - f"Unsuccessful fulfillment for user: {logging_obj['user']} with details: " + f"Unsuccessful fulfillment for user: {logging_obj['user']} " + f"due to {error_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']}]"