3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-16 14:11:50 +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 "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) { function errorHandler(err) {
const guildName = err.guild?.name || "Global"; const guildName = err.guild?.name || "Global";
const guildId = err.guild?.id || "0"; 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)) { if (err.code && SAFE_TO_IGNORE_ERIS_ERROR_CODES.includes(err.code)) {
return; return;
} }
if (err.message && SAFE_TO_IGNORE_ERIS_ERROR_MESSAGES.includes(err.message)) {
return;
}
} }
if (err instanceof DiscordHTTPError && err.code >= 500) { if (err instanceof DiscordHTTPError && err.code >= 500) {