mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 22:21:51 +00:00
Handle more connection error events gracefully
This commit is contained in:
parent
2b1a86bf0e
commit
1f79ee6939
1 changed files with 6 additions and 0 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue