Log error messages
This commit is contained in:
		
					parent
					
						
							
								1e67bef4f5
							
						
					
				
			
			
				commit
				
					
						c58302d90e
					
				
			
		
					 2 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
					@ -593,6 +593,7 @@ class OrderConfirmationView(DetailView, FormView):
 | 
				
			||||||
            return HttpResponseRedirect(reverse('datacenterlight:index'))
 | 
					            return HttpResponseRedirect(reverse('datacenterlight:index'))
 | 
				
			||||||
        if 'id_payment_method' in self.request.session:
 | 
					        if 'id_payment_method' in self.request.session:
 | 
				
			||||||
            payment_method = self.request.session['id_payment_method']
 | 
					            payment_method = self.request.session['id_payment_method']
 | 
				
			||||||
 | 
					            logger.debug("id_payment_method: %s" % payment_method)
 | 
				
			||||||
            stripe_utils = StripeUtils()
 | 
					            stripe_utils = StripeUtils()
 | 
				
			||||||
            card_details = stripe_utils.get_cards_details_from_payment_method(
 | 
					            card_details = stripe_utils.get_cards_details_from_payment_method(
 | 
				
			||||||
                payment_method
 | 
					                payment_method
 | 
				
			||||||
| 
						 | 
					@ -609,6 +610,7 @@ class OrderConfirmationView(DetailView, FormView):
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            # TODO check when we go through this case (to me, it seems useless)
 | 
					            # TODO check when we go through this case (to me, it seems useless)
 | 
				
			||||||
            card_id = self.request.session.get('card_id')
 | 
					            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)
 | 
					            card_detail = UserCardDetail.objects.get(id=card_id)
 | 
				
			||||||
            context['cc_last4'] = card_detail.last4
 | 
					            context['cc_last4'] = card_detail.last4
 | 
				
			||||||
            context['cc_brand'] = card_detail.brand
 | 
					            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):
 | 
					def get_error_response_dict(msg, request):
 | 
				
			||||||
 | 
					    logger.error(msg)
 | 
				
			||||||
    response = {
 | 
					    response = {
 | 
				
			||||||
        'status': False,
 | 
					        'status': False,
 | 
				
			||||||
        'redirect': "{url}#{section}".format(
 | 
					        'redirect': "{url}#{section}".format(
 | 
				
			||||||
| 
						 | 
					@ -1600,6 +1603,7 @@ def get_error_response_dict(msg, request):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def show_error(msg, request):
 | 
					def show_error(msg, request):
 | 
				
			||||||
 | 
					    logger.error(msg)
 | 
				
			||||||
    messages.add_message(request, messages.ERROR, msg,
 | 
					    messages.add_message(request, messages.ERROR, msg,
 | 
				
			||||||
                         extra_tags='failed_payment')
 | 
					                         extra_tags='failed_payment')
 | 
				
			||||||
    return JsonResponse(get_error_response_dict(msg,request))
 | 
					    return JsonResponse(get_error_response_dict(msg,request))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -154,6 +154,8 @@ class OpenNebulaManager():
 | 
				
			||||||
                    protocol=settings.OPENNEBULA_PROTOCOL)
 | 
					                    protocol=settings.OPENNEBULA_PROTOCOL)
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
            raise ConnectionRefusedError
 | 
					            raise ConnectionRefusedError
 | 
				
			||||||
 | 
					        except Exception as ex:
 | 
				
			||||||
 | 
					            logger.error(str(ex))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _get_user_pool(self):
 | 
					    def _get_user_pool(self):
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue