some error handling here as well
This commit is contained in:
parent
e0d1796e5c
commit
c831a14caa
|
@ -7,9 +7,13 @@ function getCommands() {
|
||||||
.map((file) => file.replace(".js", ""));
|
.map((file) => file.replace(".js", ""));
|
||||||
|
|
||||||
for (let file of commandFiles) {
|
for (let file of commandFiles) {
|
||||||
import(`../commands/${file}.js`).then((cmd) =>
|
import(`../commands/${file}.js`)
|
||||||
commands.push((commands[file] = cmd.command))
|
.then((cmd) => commands.push((commands[file] = cmd.command)))
|
||||||
);
|
.catch((err) =>
|
||||||
|
console.error(
|
||||||
|
`Error when trying to read command file ${file}: ${err.message}`
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return commands;
|
return commands;
|
||||||
|
|
Loading…
Reference in New Issue