let import error by itself
This commit is contained in:
parent
918e8aa941
commit
7547e6af57
@ -171,9 +171,7 @@ class Controller extends EventEmitter
|
|||||||
this.#commands = [];
|
this.#commands = [];
|
||||||
for (const file of files)
|
for (const file of files)
|
||||||
{
|
{
|
||||||
const imported = await import(`file://${file}`).catch(() => null);
|
const imported = await import(`file://${file}`);
|
||||||
if (!imported)
|
|
||||||
throw new Error(`Invalid file ${file}`);
|
|
||||||
const cmd = imported.default;
|
const cmd = imported.default;
|
||||||
if (typeof cmd !== 'function')
|
if (typeof cmd !== 'function')
|
||||||
return void this.#logger.warn(`Attempted to load an invalid command: ${file}`);
|
return void this.#logger.warn(`Attempted to load an invalid command: ${file}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user