From 52bd08fae0576c99c4eb714487babf5f7f1a03f2 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Wed, 11 Sep 2019 17:48:14 +0200 Subject: [PATCH] :zap: Add additional data to Error Workflow Trigger --- packages/cli/src/WorkflowExecuteAdditionalData.ts | 11 ++++++----- packages/nodes-base/nodes/ErrorTrigger.node.ts | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/WorkflowExecuteAdditionalData.ts b/packages/cli/src/WorkflowExecuteAdditionalData.ts index c51fecc659..b54d254281 100644 --- a/packages/cli/src/WorkflowExecuteAdditionalData.ts +++ b/packages/cli/src/WorkflowExecuteAdditionalData.ts @@ -37,7 +37,7 @@ import * as config from '../config'; * @param {WorkflowExecuteMode} mode The mode in which the workflow which did error got started in * @param {string} [executionId] The id the execution got saved as */ -function executeErrorWorkflow(workflowData: IWorkflowBase, fullRunData: IRun, mode: WorkflowExecuteMode, executionId?: string): void { +function executeErrorWorkflow(workflowData: IWorkflowBase, fullRunData: IRun, mode: WorkflowExecuteMode, executionId?: string, retryOf?: string): void { // Check if there was an error and if so if an errorWorkflow is set if (fullRunData.data.resultData.error !== undefined && workflowData.settings !== undefined && workflowData.settings.errorWorkflow) { const workflowErrorData = { @@ -46,6 +46,7 @@ function executeErrorWorkflow(workflowData: IWorkflowBase, fullRunData: IRun, mo error: fullRunData.data.resultData.error, lastNodeExecuted: fullRunData.data.resultData.lastNodeExecuted!, mode, + retryOf, }, workflow: { id: workflowData.id !== undefined ? workflowData.id.toString() as string : undefined, @@ -170,7 +171,7 @@ const hooks = (mode: WorkflowExecuteMode, workflowData: IWorkflowBase, execution if (mode === 'manual' && saveManualExecutions === false) { pushExecutionFinished(fullRunData, executionId, undefined, retryOf); - executeErrorWorkflow(workflowData, fullRunData, mode); + executeErrorWorkflow(workflowData, fullRunData, mode, undefined, retryOf); return; } @@ -187,7 +188,7 @@ const hooks = (mode: WorkflowExecuteMode, workflowData: IWorkflowBase, execution workflowDidSucceed === false && saveDataErrorExecution === 'none' ) { pushExecutionFinished(fullRunData, executionId, undefined, retryOf); - executeErrorWorkflow(workflowData, fullRunData, mode); + executeErrorWorkflow(workflowData, fullRunData, mode, undefined, retryOf); return; } @@ -220,10 +221,10 @@ const hooks = (mode: WorkflowExecuteMode, workflowData: IWorkflowBase, execution } pushExecutionFinished(fullRunData, executionId, executionResult.id as string, retryOf); - executeErrorWorkflow(workflowData, fullRunData, mode, executionResult ? executionResult.id as string : undefined); + executeErrorWorkflow(workflowData, fullRunData, mode, executionResult ? executionResult.id as string : undefined, retryOf); } catch (error) { pushExecutionFinished(fullRunData, executionId, undefined, retryOf); - executeErrorWorkflow(workflowData, fullRunData, mode); + executeErrorWorkflow(workflowData, fullRunData, mode, undefined, retryOf); } }, ] diff --git a/packages/nodes-base/nodes/ErrorTrigger.node.ts b/packages/nodes-base/nodes/ErrorTrigger.node.ts index 434f34cd1e..293c64b480 100644 --- a/packages/nodes-base/nodes/ErrorTrigger.node.ts +++ b/packages/nodes-base/nodes/ErrorTrigger.node.ts @@ -35,6 +35,8 @@ export class ErrorTrigger implements INodeType { // example data to allow to develope and test errorWorkflows easily items[0].json = { execution: { + id: '231', + retryOf: '34', error: { message: 'Example Error Message', stack: 'Stacktrace'