From a441a2130b23f5dbd0fdea4a3207015873391f7a Mon Sep 17 00:00:00 2001 From: Mentor Palokaj Date: Mon, 20 Dec 2021 14:11:27 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20explicit=20discord=20logging=20o?= =?UTF-8?q?f=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/integrations/discord.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/integrations/discord.js b/functions/integrations/discord.js index 33d3fa4..061c77f 100644 --- a/functions/integrations/discord.js +++ b/functions/integrations/discord.js @@ -24,7 +24,8 @@ exports.notifyDiscordWebhook = async function( username, content, avatar_url, im } // Make webhook request - await fetch( discord.webhookurl, options ) + const data = await fetch( discord.webhookurl, options ).then( res => res.json() ) + if( data.code ) throw new Error ( `Discord webhook failed with ${ data.code }: ${ data.message }` ) } catch( e ) { console.error( 'Discord error ', e )