From c58302d90e1f01beaf085b8aaf82e34b5f2edf19 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 7 Jan 2021 16:30:48 +0530 Subject: [PATCH] Log error messages --- datacenterlight/views.py | 4 ++++ opennebula_api/models.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 3d3543c5..e149bfc4 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -593,6 +593,7 @@ class OrderConfirmationView(DetailView, FormView): return HttpResponseRedirect(reverse('datacenterlight:index')) if 'id_payment_method' in self.request.session: payment_method = self.request.session['id_payment_method'] + logger.debug("id_payment_method: %s" % payment_method) stripe_utils = StripeUtils() card_details = stripe_utils.get_cards_details_from_payment_method( payment_method @@ -609,6 +610,7 @@ class OrderConfirmationView(DetailView, FormView): else: # TODO check when we go through this case (to me, it seems useless) card_id = self.request.session.get('card_id') + logger.debug("NO id_payment_method, using card: %s" % card_id) card_detail = UserCardDetail.objects.get(id=card_id) context['cc_last4'] = card_detail.last4 context['cc_brand'] = card_detail.brand @@ -1577,6 +1579,7 @@ def do_provisioning(request, stripe_api_cus_id, card_details_response, def get_error_response_dict(msg, request): + logger.error(msg) response = { 'status': False, 'redirect': "{url}#{section}".format( @@ -1600,6 +1603,7 @@ def get_error_response_dict(msg, request): def show_error(msg, request): + logger.error(msg) messages.add_message(request, messages.ERROR, msg, extra_tags='failed_payment') return JsonResponse(get_error_response_dict(msg,request)) diff --git a/opennebula_api/models.py b/opennebula_api/models.py index 92d5c568..2f76f423 100644 --- a/opennebula_api/models.py +++ b/opennebula_api/models.py @@ -154,6 +154,8 @@ class OpenNebulaManager(): protocol=settings.OPENNEBULA_PROTOCOL) ) raise ConnectionRefusedError + except Exception as ex: + logger.error(str(ex)) def _get_user_pool(self): try: