Improve error handling when executing a custorder batch

This commit is contained in:
Lance Edgar 2021-11-11 13:37:10 -06:00
parent 6e15d59a84
commit 3a10a4bcb7
2 changed files with 17 additions and 16 deletions

View file

@ -779,9 +779,13 @@ class CustomerOrderView(MasterView):
'batch': self.normalize_batch(batch)}
def submit_new_order(self, batch, data):
result = self.execute_new_order_batch(batch, data)
if not result:
return {'error': "Batch failed to execute"}
try:
result = self.execute_new_order_batch(batch, data)
except Exception as error:
return {'error': six.text_type(error)}
else:
if not result:
return {'error': "Batch failed to execute"}
next_url = None
if isinstance(result, model.CustomerOrder):