The execute()
method in a node must implement continueOnFail
in a try-catch block.
📋 This rule is part of the plugin:n8n-nodes-base/nodes
config.
❌ Example of incorrect code:
class TestNode {
description = {
displayName: "Test",
name: "test",
icon: "file:test.svg",
group: ["transform"],
version: 1,
subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
description: "This is a sentence",
defaults: {
name: "Test",
},
inputs: ["main"],
outputs: ["main"],
};
async execute() {
for (let i = 0; i < items.length; i++) {
try {
// ...
} catch (error) {
// ...
}
}
}
}
class TestNode {
description = {
displayName: "Test",
name: "test",
icon: "file:test.svg",
group: ["transform"],
version: 1,
subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
description: "This is a sentence",
defaults: {
name: "Test",
},
inputs: ["main"],
outputs: ["main"],
};
async execute() {
for (let i = 0; i < items.length; i++) {
// ...
}
}
}
✅ Example of correct code:
class TestNode {
description = {
displayName: "Test",
name: "test",
icon: "file:test.svg",
group: ["transform"],
version: 1,
subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
description: "This is a sentence",
defaults: {
name: "Test",
},
inputs: ["main"],
outputs: ["main"],
};
async execute() {
for (let i = 0; i < items.length; i++) {
try {
// ...
} catch (error) {
if (this.continueOnFail()) {
// ...
}
}
}
}
}