From 120a4c2b0709f071a90c7e9ec8a9f888abda2314 Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Thu, 20 Oct 2022 20:44:37 +0200 Subject: [PATCH] fix: mark step completed only when successful --- packages/backend/src/graphql/mutations/execute-flow.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/graphql/mutations/execute-flow.ts b/packages/backend/src/graphql/mutations/execute-flow.ts index b35e4a82..5caeaa77 100644 --- a/packages/backend/src/graphql/mutations/execute-flow.ts +++ b/packages/backend/src/graphql/mutations/execute-flow.ts @@ -19,14 +19,14 @@ const executeFlow = async ( .$relatedQuery('steps') .findById(stepId); - await untilStep.$query().patch({ - status: 'completed', - }); - if (executionStep.isFailed) { throw new Error(JSON.stringify(executionStep.errorDetails)); } + await untilStep.$query().patch({ + status: 'completed', + }); + return { data: executionStep.dataOut, step: untilStep }; };