豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 07c0891

Browse files
update error handling & add source header
1 parent b1562f0 commit 07c0891

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

nodes/HasData/HasData.node.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
INodeProperties,
88
INodeType,
99
INodeTypeDescription,
10+
NodeApiError,
1011
} from 'n8n-workflow';
1112

1213
import { airbnbFields, airbnbOperations } from './descriptions/AirbnbDescription';
@@ -276,6 +277,9 @@ export class HasData implements INodeType {
276277
qs,
277278
body: method === 'POST' ? body : undefined,
278279
json: true,
280+
headers: {
281+
'x-request-source': 'n8n',
282+
},
279283
},
280284
);
281285

@@ -290,7 +294,7 @@ export class HasData implements INodeType {
290294
returnData.push({ json: { error: error.message } });
291295
continue;
292296
}
293-
throw error;
297+
throw new NodeApiError(this.getNode(), error as any);
294298
}
295299
}
296300

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"access": "public",
55
"registry": "https://registry.npmjs.org/"
66
},
7-
"version": "1.0.0",
7+
"version": "1.0.1",
88
"description": "n8n node for HasData APIs",
99
"license": "MIT",
1010
"homepage": "https://hasdata.com",
@@ -55,4 +55,4 @@
5555
"peerDependencies": {
5656
"n8n-workflow": "*"
5757
}
58-
}
58+
}

0 commit comments

Comments
 (0)