1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-08-09 07:25:24 +02:00

fix: webhooks fetch wrapped into try catch

This commit is contained in:
Αλέξανδρος 2024-06-29 13:26:40 +03:00
parent 72896a66b3
commit 880a27770b

View file

@ -116,6 +116,7 @@ async function sendWebhook(webhook, event, data, user) {
user: sails.helpers.utils.jsonifyRecord(user), user: sails.helpers.utils.jsonifyRecord(user),
}); });
try {
const response = await fetch(webhook.url, { const response = await fetch(webhook.url, {
headers, headers,
body, body,
@ -129,6 +130,11 @@ async function sendWebhook(webhook, event, data, user) {
`Webhook ${webhook.url} failed with status ${response.status} and message: ${message}`, `Webhook ${webhook.url} failed with status ${response.status} and message: ${message}`,
); );
} }
} catch (e) {
sails.log.error(
`Webhook ${webhook.url} failed with error message: ${e.message}`,
);
}
} }
module.exports = { module.exports = {