Also handle error 1001 gracefully
parent
4decd42294
commit
4663886629
12
src/bot.js
12
src/bot.js
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue