desperately trying to make error handling work

This commit is contained in:
Aster Fialla
2026-02-14 18:10:53 -05:00
committed by pieartsy
parent d2007f5274
commit 6339da1592
4 changed files with 7 additions and 8 deletions

5
bot.js
View File

@@ -36,12 +36,11 @@ client.on(Events.MessageCreate, async (message) => {
const command = commands.get(commandName);
if (command) {
await command.execute(message, client, args).catch(async (e) => {
throw new Error(`Error executing ${commandName}: ${e.message}`);
});
await command.execute(message, client, args);
}
}
catch(error) {
console.error(error);
return await message.reply(error.message);
}
});