Allow batch view to override execution failure message

This commit is contained in:
Lance Edgar 2017-05-11 09:49:15 -05:00
parent 02962fbf87
commit 56695d0c20

View file

@ -752,6 +752,9 @@ class BatchMasterView(MasterView):
self.request.session.flash("Sorry, you must POST to execute a batch.", 'error')
return self.redirect(self.get_action_url('view', batch))
def execute_error_message(self, error):
return "Batch execution failed: {}: {}".format(type(error).__name__, error)
def execute_thread(self, batch_uuid, user_uuid, progress=None, **kwargs):
"""
Thread target for executing a batch with progress indicator.
@ -773,7 +776,7 @@ class BatchMasterView(MasterView):
if progress:
progress.session.load()
progress.session['error'] = True
progress.session['error_msg'] = "Batch execution failed: {}: {}".format(type(error).__name__, error)
progress.session['error_msg'] = self.execute_error_message(error)
progress.session.save()
# If no error, check result flag (false means user canceled).