return error when it occurs

This commit is contained in:
Aster Fialla
2026-02-14 13:10:43 -05:00
committed by pieartsy
parent 851bae4ff8
commit 0d129f23e7
3 changed files with 6 additions and 6 deletions

5
bot.js
View File

@@ -36,9 +36,8 @@ client.on(Events.MessageCreate, async (message) => {
const command = commands.get(commandName);
if (command) {
await command.execute(message, client, args).catch(async () => {
await message.reply('An error occurred while running that command.')
throw new Error(`Error executing ${commandName}:`);
await command.execute(message, client, args).catch(async (e) => {
throw new Error(`Error executing ${commandName}: ${e.message}`);
});
}
}

View File

@@ -6,10 +6,11 @@ import {EmbedBuilder} from "@fluxerjs/core";
const cmds = new Map();
cmds.set('member', {
alias: 'm',
description: enums.help.SHORT_DESC_MEMBER,
async execute(message, client, args) {
const reply = await memberHelper.parseMemberCommand(message.author.id, args, message.attachments[0] ?? null);
const reply = await memberHelper.parseMemberCommand(message.author.id, args, message.attachments[0] ?? null).catch(async (e) => {
return await message.reply(e);
});
return await message.reply(reply);
}
})

View File

@@ -1,7 +1,7 @@
import { db } from '../sequelize.js';
import {enums} from "../enums.js";
import { loadImage } from "canvas";
import {EmptyResultError, InstanceError} from "sequelize";
import {EmptyResultError} from "sequelize";
const mh = {};