From c831a14caa07d54e441a5672426d763d5a14ab27 Mon Sep 17 00:00:00 2001 From: Joonas Date: Sat, 11 Feb 2023 14:16:55 +0200 Subject: [PATCH] some error handling here as well --- utils/commands.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils/commands.js b/utils/commands.js index 6988392..2a0c25d 100644 --- a/utils/commands.js +++ b/utils/commands.js @@ -7,9 +7,13 @@ function getCommands() { .map((file) => file.replace(".js", "")); for (let file of commandFiles) { - import(`../commands/${file}.js`).then((cmd) => - commands.push((commands[file] = cmd.command)) - ); + import(`../commands/${file}.js`) + .then((cmd) => commands.push((commands[file] = cmd.command))) + .catch((err) => + console.error( + `Error when trying to read command file ${file}: ${err.message}` + ) + ); } return commands;