refactor: Remove usless catch blocks, and add a linting rule to prevent them (no-changelog) (#12730)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-01-20 18:20:04 +01:00
committed by GitHub
parent 4ee4552b0e
commit 202da76380
17 changed files with 220 additions and 242 deletions

View File

@@ -115,7 +115,6 @@ export class PayPalTrigger implements INodeType {
},
async create(this: IHookFunctions): Promise<boolean> {
let webhook;
const webhookUrl = this.getNodeWebhookUrl('default');
const events = this.getNodeParameter('events', []) as string[];
const body = {
@@ -125,11 +124,7 @@ export class PayPalTrigger implements INodeType {
}),
};
const endpoint = '/notifications/webhooks';
try {
webhook = await payPalApiRequest.call(this, endpoint, 'POST', body);
} catch (error) {
throw error;
}
const webhook = await payPalApiRequest.call(this, endpoint, 'POST', body);
if (webhook.id === undefined) {
return false;
@@ -156,7 +151,6 @@ export class PayPalTrigger implements INodeType {
};
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
let webhook;
const webhookData = this.getWorkflowStaticData('node');
const bodyData = this.getBodyData();
const req = this.getRequestObject();
@@ -188,11 +182,7 @@ export class PayPalTrigger implements INodeType {
webhook_id: webhookData.webhookId,
webhook_event: bodyData,
};
try {
webhook = await payPalApiRequest.call(this, endpoint, 'POST', body);
} catch (error) {
throw error;
}
const webhook = await payPalApiRequest.call(this, endpoint, 'POST', body);
if (webhook.verification_status !== 'SUCCESS') {
return {};
}