From 7547e6af57e97d866054cece66bd4b88a3dffc35 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 17 Jan 2024 18:09:00 +0200 Subject: [PATCH] let import error by itself --- src/controller/Controller.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/controller/Controller.ts b/src/controller/Controller.ts index 715d602..f3f07cf 100644 --- a/src/controller/Controller.ts +++ b/src/controller/Controller.ts @@ -171,9 +171,7 @@ class Controller extends EventEmitter this.#commands = []; for (const file of files) { - const imported = await import(`file://${file}`).catch(() => null); - if (!imported) - throw new Error(`Invalid file ${file}`); + const imported = await import(`file://${file}`); const cmd = imported.default; if (typeof cmd !== 'function') return void this.#logger.warn(`Attempted to load an invalid command: ${file}`);