From ccd56a1d8886d0991c0219413f059e616471ea39 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Wed, 21 Oct 2020 21:41:38 +0300 Subject: [PATCH] Handle error 1006 (Connection reset by peer) gracefully --- src/bot.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/bot.js b/src/bot.js index 1338d03..4293f89 100644 --- a/src/bot.js +++ b/src/bot.js @@ -27,6 +27,16 @@ const bot = new Eris.Client(config.token, { }, }); +bot.on("error", err => { + if (err.code === 1006) { + // 1006 = "Connection reset by peer" + // Eris allegedly handles this internally, so we can ignore it + return; + } + + throw err; +}); + /** * @type {Eris.Client} */