From 8880f96a6ea4f3ad897fac399b771edb61451a20 Mon Sep 17 00:00:00 2001 From: chimpdev Date: Wed, 20 Nov 2024 22:57:47 +0300 Subject: [PATCH] refactor: simplify error handling in incrementVote functions --- server/src/utils/bots/incrementVote.js | 6 +----- server/src/utils/servers/incrementVote.js | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/server/src/utils/bots/incrementVote.js b/server/src/utils/bots/incrementVote.js index 099f3819..8ef8a169 100644 --- a/server/src/utils/bots/incrementVote.js +++ b/server/src/utils/bots/incrementVote.js @@ -128,11 +128,7 @@ async function incrementVote(botId, userId, botWebhook) { } const response = await axios(requestConfig) - .catch(error => { - logger.error(`Error while sending webhook request for bot ${bot.id}:`, error); - - return error.response; - }); + .catch(error => error.response); const data = { url: botWebhook.url, diff --git a/server/src/utils/servers/incrementVote.js b/server/src/utils/servers/incrementVote.js index 4db28bb0..d42bc3d7 100644 --- a/server/src/utils/servers/incrementVote.js +++ b/server/src/utils/servers/incrementVote.js @@ -177,11 +177,7 @@ async function incrementVote(guildId, userId) { } const response = await axios(requestConfig) - .catch(error => { - logger.error(`Error while sending webhook request for guild ${guild.id}:`, error); - - return error.response; - }); + .catch(error => error.response); const data = { url: server.webhook.url,