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
import decimal
import logging
import six
from sqlalchemy import orm
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 webhelpers2.html import tags, HTML
@ -41,6 +42,9 @@ from tailbone.db import Session
from tailbone.views import MasterView
log = logging.getLogger(__name__)
class CustomerOrderView(MasterView):
"""
Master view for customer orders
@ -908,7 +912,9 @@ class CustomerOrderView(MasterView):
try:
result = self.execute_new_order_batch(batch, data)
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:
if not result:
return {'error': "Batch failed to execute"}