Skip to content

Commit

Permalink
fix(core): Prevent app crashes because of unhandled promises in poll …
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy authored May 19, 2023
1 parent be5d326 commit 3750605
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/cli/src/ActiveWorkflowRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,10 @@ export class ActiveWorkflowRunner {
}
};

returnFunctions.__emitError = async (error: ExecutionError): Promise<void> => {
await createErrorExecution(error, node, workflowData, workflow, mode);
this.executeErrorWorkflow(error, workflowData, mode);
returnFunctions.__emitError = (error: ExecutionError): void => {
void createErrorExecution(error, node, workflowData, workflow, mode).then(() => {
this.executeErrorWorkflow(error, workflowData, mode);
});
};
return returnFunctions;
};
Expand Down Expand Up @@ -707,7 +708,7 @@ export class ActiveWorkflowRunner {
executePromise.catch(Logger.error);
}
};
returnFunctions.emitError = async (error: Error): Promise<void> => {
returnFunctions.emitError = (error: Error): void => {
Logger.info(
`The trigger node "${node.name}" of workflow "${workflowData.name}" failed with the error: "${error.message}". Will try to reactivate.`,
{
Expand All @@ -719,7 +720,7 @@ export class ActiveWorkflowRunner {

// Remove the workflow as "active"

await this.activeWorkflows.remove(workflowData.id);
void this.activeWorkflows.remove(workflowData.id);
this.activationErrors[workflowData.id] = {
time: new Date().getTime(),
error: {
Expand Down

0 comments on commit 3750605

Please sign in to comment.