Fix require response codes

This commit is contained in:
2023-05-24 16:36:37 +02:00
parent 8f5a1abdc7
commit a6daaf4dd6

View File

@@ -1,5 +1,5 @@
const axios = require('axios'); const axios = require('axios');
const STATUS_CODES = require('http'); const { STATUS_CODES } = require('http');
const { Webhook, MessageBuilder } = require('discord-webhook-node'); const { Webhook, MessageBuilder } = require('discord-webhook-node');
// API endpoint URL to ping // API endpoint URL to ping
@@ -41,7 +41,7 @@ async function pingEndpoint() {
// Send an error message to the Discord webhook // Send an error message to the Discord webhook
consecutiveFailures += 1; consecutiveFailures += 1;
console.log(`ERROR PINGING API. HARD FAIL (${consecutiveFailures})`); 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]}`);
} }
} }