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", ""));
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue