Log error when failing to submit new custorder batch

This commit is contained in:
Lance Edgar 2022-03-29 17:43:42 -05:00
parent 80b9593651
commit 4e25e87bfb

View file

@ -27,12 +27,13 @@ Customer Order Views
from __future__ import unicode_literals, absolute_import from __future__ import unicode_literals, absolute_import
import decimal import decimal
import logging
import six import six
from sqlalchemy import orm from sqlalchemy import orm
from rattail.db import model from rattail.db import model
from rattail.util import pretty_quantity from rattail.util import pretty_quantity, simple_error
from rattail.batch import get_batch_handler from rattail.batch import get_batch_handler
from webhelpers2.html import tags, HTML from webhelpers2.html import tags, HTML
@ -41,6 +42,9 @@ from tailbone.db import Session
from tailbone.views import MasterView from tailbone.views import MasterView
log = logging.getLogger(__name__)
class CustomerOrderView(MasterView): class CustomerOrderView(MasterView):
""" """
Master view for customer orders Master view for customer orders
@ -908,7 +912,9 @@ class CustomerOrderView(MasterView):
try: try:
result = self.execute_new_order_batch(batch, data) result = self.execute_new_order_batch(batch, data)
except Exception as error: except Exception as error:
return {'error': six.text_type(error)} log.warning("failed to execute new order batch: %s", batch,
exc_info=True)
return {'error': simple_error(error)}
else: else:
if not result: if not result:
return {'error': "Batch failed to execute"} return {'error': "Batch failed to execute"}