remove isAbortError

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-11-04 12:27:19 +01:00
parent 18da8e0b8f
commit 301b1366d9
No known key found for this signature in database
2 changed files with 6 additions and 24 deletions

View file

@ -155,10 +155,6 @@ export class WorkflowExecute {
return this.processRunExecutionData(workflow);
}
static isAbortError(e?: Error) {
return e?.name === 'AbortError' || e instanceof ExecutionCancelledError;
}
forceInputNodeExecution(workflow: Workflow): boolean {
return workflow.settings.executionOrder !== 'v1';
}
@ -1480,7 +1476,7 @@ export class WorkflowExecute {
// Add the execution data again so that it can get restarted
this.runExecutionData.executionData!.nodeExecutionStack.unshift(executionData);
// Only execute the nodeExecuteAfter hook if the node did not get aborted
if (!WorkflowExecute.isAbortError(executionError)) {
if (!this.isCancelled) {
await this.executeHook('nodeExecuteAfter', [
executionNode.name,
taskData,
@ -1929,7 +1925,7 @@ export class WorkflowExecute {
this.moveNodeMetadata();
// Prevent from running the hook if the error is an abort error as it was already handled
if (!WorkflowExecute.isAbortError(executionError)) {
if (!this.isCancelled) {
await this.executeHook('workflowExecuteAfter', [fullRunData, newStaticData]);
}
@ -1960,4 +1956,8 @@ export class WorkflowExecute {
return fullRunData;
}
private get isCancelled() {
return this.abortController.signal.aborted;
}
}

View file

@ -2,10 +2,8 @@ import type { IRun, WorkflowTestData } from 'n8n-workflow';
import {
ApplicationError,
createDeferredPromise,
ExecutionCancelledError,
NodeExecutionOutput,
Workflow,
WorkflowOperationError,
} from 'n8n-workflow';
import { WorkflowExecute } from '@/WorkflowExecute';
@ -215,20 +213,4 @@ describe('WorkflowExecute', () => {
expect(nodeExecutionOutput[0][0].json.data).toEqual(123);
expect(nodeExecutionOutput.getHints()[0].message).toEqual('TEXT HINT');
});
describe('isAbortError', () => {
test.each([
['AbortError', new DOMException('', 'AbortError')],
['WorkflowOperationError', new ExecutionCancelledError('1234')],
])('returns true when passed a %s', (_name, error) => {
expect(WorkflowExecute.isAbortError(error)).toBe(true);
});
test.each([
['TypeError', new TypeError()],
['WorkflowOperationError', new WorkflowOperationError('test')],
])('returns false when passed a %s', (_name, error) => {
expect(WorkflowExecute.isAbortError(error)).toBe(false);
});
});
});