fix: mark step completed only when successful

This commit is contained in:
Ali BARIN
2022-10-20 20:44:37 +02:00
parent 97f88d6c4a
commit 120a4c2b07

View File

@@ -19,14 +19,14 @@ const executeFlow = async (
.$relatedQuery('steps') .$relatedQuery('steps')
.findById(stepId); .findById(stepId);
await untilStep.$query().patch({
status: 'completed',
});
if (executionStep.isFailed) { if (executionStep.isFailed) {
throw new Error(JSON.stringify(executionStep.errorDetails)); throw new Error(JSON.stringify(executionStep.errorDetails));
} }
await untilStep.$query().patch({
status: 'completed',
});
return { data: executionStep.dataOut, step: untilStep }; return { data: executionStep.dataOut, step: untilStep };
}; };