mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 05:09:43 +02:00
fix: Fix application crashing when webhook is unavailable (#815)
This commit is contained in:
parent
6009370cb0
commit
9024c793df
1 changed files with 14 additions and 10 deletions
|
@ -116,18 +116,22 @@ async function sendWebhook(webhook, event, data, user) {
|
||||||
user: sails.helpers.utils.jsonifyRecord(user),
|
user: sails.helpers.utils.jsonifyRecord(user),
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = await fetch(webhook.url, {
|
try {
|
||||||
headers,
|
const response = await fetch(webhook.url, {
|
||||||
body,
|
headers,
|
||||||
method: 'POST',
|
body,
|
||||||
});
|
method: 'POST',
|
||||||
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
const message = await response.text();
|
const message = await response.text();
|
||||||
|
|
||||||
sails.log.error(
|
sails.log.error(
|
||||||
`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}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue