fix: Expose errors within execute flow mutation

This commit is contained in:
Faruk AYDIN
2022-09-27 23:33:58 +03:00
parent 18f315d26c
commit 8e60f3dfd7
2 changed files with 7 additions and 7 deletions

View File

@@ -24,7 +24,7 @@ const executeFlow = async (
const flow = await untilStep.$relatedQuery('flow'); const flow = await untilStep.$relatedQuery('flow');
const data = await new Processor(flow, { const executionStep = await new Processor(flow, {
untilStep, untilStep,
testRun: true, testRun: true,
}).run(); }).run();
@@ -33,7 +33,11 @@ const executeFlow = async (
status: 'completed', status: 'completed',
}); });
return { data, step: untilStep }; if (executionStep.errorDetails) {
throw new Error(JSON.stringify(executionStep.errorDetails, null, 2));
}
return { data: executionStep.dataOut, step: untilStep };
}; };
export default executeFlow; export default executeFlow;

View File

@@ -160,11 +160,7 @@ class Processor {
.orderBy('created_at', 'desc') .orderBy('created_at', 'desc')
.first(); .first();
if (lastExecutionStepFromFirstExecution.errorDetails) { return lastExecutionStepFromFirstExecution;
return lastExecutionStepFromFirstExecution.errorDetails;
} else {
return lastExecutionStepFromFirstExecution?.dataOut;
}
} }
async getInitialTriggerData(step: Step) { async getInitialTriggerData(step: Step) {