Skip to content

Commit

Permalink
Merge pull request #81 from mrrfv/discord-webhook-try-catch
Browse files Browse the repository at this point in the history
Add error handling when sending message to Discord webhook
  • Loading branch information
mrrfv authored Mar 21, 2024
2 parents 48f4d71 + 1f57df1 commit 64603fc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ export async function notifyWebhook(msg) {

if (webhook_url && webhook_url.startsWith('http')) {
// Send the message to the webhook
await sendMessageToWebhook(webhook_url, `CGPS: ${msg}`);
try {
await sendMessageToWebhook(webhook_url, `CGPS: ${msg}`);
} catch (e) {
console.error('Error sending message to Discord webhook:', e);
}
}
// Not logging the lack of a webhook URL since it's not a feature everyone would use
}
Expand Down

0 comments on commit 64603fc

Please sign in to comment.