workflows: log status item on external workflow action error (#45652)

This commit is contained in:
Thomas NOËL 2020-08-04 11:31:35 +02:00
parent 02fd08460c
commit 7f155f3a52
2 changed files with 4 additions and 2 deletions

View File

@ -4891,6 +4891,7 @@ def test_call_external_workflow_with_evolution_linked_object(pub):
logged_error = LoggedError.select()[0]
assert logged_error.summary == 'Could not find linked "External Form" object by id %s' % external_formdata.id
assert logged_error.exception_class == 'KeyError'
assert logged_error.status_item_id == action.id
# try remove an unexisting carddef: do nothing
unused_carddef = CardDef()

View File

@ -144,7 +144,7 @@ class ExternalWorkflowGlobalAction(WorkflowStatusItem):
# use custom error message depending on target type
LoggedError.record(_('Could not find linked "%(object_name)s" object by id %(object_id)s') % {
'object_name': objectdef.name, 'object_id': target_id},
formdata=formdata, exception=e)
formdata=formdata, status_item=self, exception=e)
def get_parameters(self):
return ('slug', 'trigger_id', 'condition')
@ -156,7 +156,8 @@ class ExternalWorkflowGlobalAction(WorkflowStatusItem):
trigger = self.get_trigger(objectdef.workflow)
if not trigger:
LoggedError.record(_('No trigger with id "%s" found in workflow') % self.trigger_id)
LoggedError.record(_('No trigger with id "%s" found in workflow') % self.trigger_id,
formdata=formdata, status_item=self)
return
class CallerSource: