From a6daaf4dd620d68b586aebc64fbbb6b7848b9210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Gro=C3=9F?= Date: Wed, 24 May 2023 16:36:37 +0200 Subject: [PATCH] Fix require response codes --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 3619848..2a74196 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ const axios = require('axios'); -const STATUS_CODES = require('http'); +const { STATUS_CODES } = require('http'); const { Webhook, MessageBuilder } = require('discord-webhook-node'); // API endpoint URL to ping @@ -41,7 +41,7 @@ async function pingEndpoint() { // Send an error message to the Discord webhook consecutiveFailures += 1; console.log(`ERROR PINGING API. HARD FAIL (${consecutiveFailures})`); - handleFailure(`Error occurred while pinging the API endpoint.\n${error}`); + handleFailure(`Error occurred while pinging the API endpoint.\n${error.message}\n${STATUS_CODES[error.response.status]}`); } }