From cda25adca414e3d1524f6be2d1adf6052ac816cb Mon Sep 17 00:00:00 2001 From: gnehs Date: Fri, 19 Jul 2024 13:37:41 +0800 Subject: [PATCH] chore: Refactor error handling and launch method in index.js --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b26a0cb..8ce83c0 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,9 @@ bot.use( require("./components/subscribe/index") ); -bot.launch().catch((err) => { - console.log(err); +bot.launch(); + +// catch error +process.on("unhandledRejection", (error) => { + console.error(error); });