🐛 Remove Test-Webhook also if checkExists fails

This commit is contained in:
Jan Oberhauser 2020-08-27 13:37:17 +02:00
parent 685aa2cf82
commit f56960f0cc

View file

@ -50,11 +50,13 @@ export class ActiveWebhooks {
// it gets called // it gets called
this.webhookUrls[webhookKey] = webhookData; this.webhookUrls[webhookKey] = webhookData;
try {
const webhookExists = await workflow.runWebhookMethod('checkExists', webhookData, NodeExecuteFunctions, mode, this.testWebhooks); const webhookExists = await workflow.runWebhookMethod('checkExists', webhookData, NodeExecuteFunctions, mode, this.testWebhooks);
if (webhookExists === false) { if (webhookExists === false) {
// If webhook does not exist yet create it // If webhook does not exist yet create it
try {
await workflow.runWebhookMethod('create', webhookData, NodeExecuteFunctions, mode, this.testWebhooks); await workflow.runWebhookMethod('create', webhookData, NodeExecuteFunctions, mode, this.testWebhooks);
}
} catch (error) { } catch (error) {
// If there was a problem unregister the webhook again // If there was a problem unregister the webhook again
delete this.webhookUrls[webhookKey]; delete this.webhookUrls[webhookKey];
@ -62,8 +64,6 @@ export class ActiveWebhooks {
throw error; throw error;
} }
}
this.workflowWebhooks[webhookData.workflowId].push(webhookData); this.workflowWebhooks[webhookData.workflowId].push(webhookData);
} }