From 204977952d1453f4b4ef393021772ddf4b590f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hor=C3=A1=C4=8Dek?= Date: Tue, 31 Mar 2020 13:36:17 +0200 Subject: [PATCH] error handling for events & commands --- index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 22625c7..9999bff 100644 --- a/index.js +++ b/index.js @@ -61,7 +61,12 @@ client.aliases = new Discord.Collection() const init = async () => { // Load events fs.readdir('./events', (err, files) => { - if (err) {} + if (err) { + client.logger.error('Failed to get files in events directory! ' + err); + + return; + }; + client.logger.info(`Loading ${files.length} events.`) files.forEach(file => { if (!file.endsWith('.js')) { @@ -74,7 +79,12 @@ const init = async () => { // Load commands fs.readdir('./commands', (err, files) => { - if (err) {} + if (err) { + client.logger.error('Failed to get files in commands directory! ' + err); + + return; + }; + client.logger.info(`Loading ${files.length} commands.`) files.forEach(file => { if (!file.endsWith('.js')) {