fix: Fix application crashing when webhook is unavailable (#815)

pull/824/head
Αλέξανδρος 1 year ago committed by GitHub
parent 67d1b1c194
commit 6052f8999f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -116,6 +116,7 @@ async function sendWebhook(webhook, event, data, user) {
user: sails.helpers.utils.jsonifyRecord(user),
});
try {
const response = await fetch(webhook.url, {
headers,
body,
@ -129,6 +130,9 @@ async function sendWebhook(webhook, event, data, user) {
`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 = {

Loading…
Cancel
Save