Also handle error 1001 gracefully

cshd
Dragory 2020-10-25 03:52:27 +02:00
parent 4decd42294
commit 4663886629
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
1 changed files with 8 additions and 4 deletions

View File

@ -27,11 +27,15 @@ const bot = new Eris.Client(config.token, {
},
});
// Eris allegedly handles these internally, so we can ignore them
const SAFE_TO_IGNORE_ERROR_CODES = [
1001, // "CloudFlare WebSocket proxy restarting"
1006, // "Connection reset by peer"
"ECONNRESET", // Pretty much the same as above
];
bot.on("error", err => {
if (err.code === 1006 || err.code === "ECONNRESET") {
// 1006 = "Connection reset by peer"
// ECONNRESET is similar
// Eris allegedly handles these internally, so we can ignore them
if (SAFE_TO_IGNORE_ERROR_CODES.includes(err.code)) {
return;
}