Conditional chaining in case response is undefined

This commit is contained in:
2023-05-24 17:09:19 +02:00
parent bb74f5b13b
commit f61060a5b7

View File

@@ -42,7 +42,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.message}\n${STATUS_CODES[error.response.status]}`);
handleFailure(`Error occurred while pinging the API endpoint.\n${error.message}\n${STATUS_CODES[error.response?.status]}`);
}
}