diff --git a/packages/cli/src/ActiveExecutions.ts b/packages/cli/src/ActiveExecutions.ts index 567da64137..500003d8b6 100644 --- a/packages/cli/src/ActiveExecutions.ts +++ b/packages/cli/src/ActiveExecutions.ts @@ -7,7 +7,7 @@ import type { IRun, ExecutionStatus, } from 'n8n-workflow'; -import { createDeferredPromise } from 'n8n-workflow'; +import { WorkflowOperationError, createDeferredPromise } from 'n8n-workflow'; import type { ChildProcess } from 'child_process'; import type PCancelable from 'p-cancelable'; @@ -190,13 +190,13 @@ export class ActiveExecutions { * @param {string} executionId The id of the execution to wait for */ async getPostExecutePromise(executionId: string): Promise { + if (this.activeExecutions[executionId] === undefined) { + throw new WorkflowOperationError(`There is no active execution with id "${executionId}".`); + } + // Create the promise which will be resolved when the execution finished const waitPromise = await createDeferredPromise(); - if (this.activeExecutions[executionId] === undefined) { - throw new Error(`There is no active execution with id "${executionId}".`); - } - this.activeExecutions[executionId].postExecutePromises.push(waitPromise); return waitPromise.promise(); diff --git a/packages/workflow/src/WorkflowErrors.ts b/packages/workflow/src/WorkflowErrors.ts index 79ab34f715..662dfda1cb 100644 --- a/packages/workflow/src/WorkflowErrors.ts +++ b/packages/workflow/src/WorkflowErrors.ts @@ -15,6 +15,7 @@ export class WorkflowOperationError extends ExecutionBaseError { constructor(message: string, node?: INode) { super(message, { cause: undefined }); + this.severity = 'warning'; this.name = this.constructor.name; this.node = node; this.timestamp = Date.now();