Skip to content

Commit 56054dc

Browse files
improve errors handling
1 parent 07c0891 commit 56054dc

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

nodes/HasData/HasData.node.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
INodeProperties,
88
INodeType,
99
INodeTypeDescription,
10-
NodeApiError,
10+
NodeOperationError,
1111
} from 'n8n-workflow';
1212

1313
import { airbnbFields, airbnbOperations } from './descriptions/AirbnbDescription';
@@ -291,10 +291,20 @@ export class HasData implements INodeType {
291291

292292
} catch (error) {
293293
if (this.continueOnFail()) {
294-
returnData.push({ json: { error: error.message } });
294+
returnData.push({
295+
json: {
296+
error: error.message,
297+
},
298+
pairedItem: {
299+
item: i
300+
}
301+
});
295302
continue;
296303
}
297-
throw new NodeApiError(this.getNode(), error as any);
304+
305+
throw new NodeOperationError(this.getNode(), error, {
306+
itemIndex: i
307+
});
298308
}
299309
}
300310

0 commit comments

Comments
 (0)