3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Handle more connection error events gracefully

This commit is contained in:
Dragory 2020-12-19 03:07:41 +02:00
parent 2b1a86bf0e
commit 1f79ee6939
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -59,6 +59,8 @@ const SAFE_TO_IGNORE_ERIS_ERROR_CODES = [
"ECONNRESET", // Pretty much the same as above
];
const SAFE_TO_IGNORE_ERIS_ERROR_MESSAGES = ["Server didn't acknowledge previous heartbeat, possible lost connection"];
function errorHandler(err) {
const guildName = err.guild?.name || "Global";
const guildId = err.guild?.id || "0";
@ -88,6 +90,10 @@ function errorHandler(err) {
if (err.code && SAFE_TO_IGNORE_ERIS_ERROR_CODES.includes(err.code)) {
return;
}
if (err.message && SAFE_TO_IGNORE_ERIS_ERROR_MESSAGES.includes(err.message)) {
return;
}
}
if (err instanceof DiscordHTTPError && err.code >= 500) {