Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions nodes/ExampleNode/ExampleNode.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ export class ExampleNode implements INodeType {
// You can make async calls and use `await`.
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const itemCount = items.length;

let item: INodeExecutionData;
let myString: string;

// Iterates over all input items and add the key "myString" with the
// value the parameter "myString" resolves to.
// (This could be a different value for each item in case it contains an expression)
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
for (let itemIndex = 0; itemIndex < itemCount; itemIndex++) {
try {
myString = this.getNodeParameter('myString', itemIndex, '') as string;
item = items[itemIndex];
Expand All @@ -56,7 +57,7 @@ export class ExampleNode implements INodeType {
// This node should never fail but we want to showcase how
// to handle errors.
if (this.continueOnFail()) {
items.push({ json: this.getInputData(itemIndex)[0].json, error, pairedItem: itemIndex });
items[itemIndex].error = error;
} else {
// Adding `itemIndex` allows other workflows to handle this error
if (error.context) {
Expand Down