From c9e0dbf0407484a30c1b796765c9a0514f3a3cd8 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Mon, 12 Oct 2020 20:00:55 +0300 Subject: [PATCH] Handle unhandled rejections the same way as uncaught exceptions --- src/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 73a4b29..cc2d662 100644 --- a/src/index.js +++ b/src/index.js @@ -17,7 +17,7 @@ try { } // Error handling -process.on("uncaughtException", err => { +function errorHandler(err) { // Unknown message types (nitro boosting messages at the time) should be safe to ignore if (err && err.message && err.message.startsWith("Unhandled MESSAGE_CREATE type")) { return; @@ -26,7 +26,9 @@ process.on("uncaughtException", err => { // For everything else, crash with the error console.error(err); process.exit(1); -}); +} +process.on("uncaughtException", errorHandler); +process.on("unhandledRejection", errorHandler); let testedPackage = ""; try {