feat(commands): improve error feedback for economy and admin commands
This commit is contained in:
@@ -2,6 +2,7 @@ import { createCommand } from "@/lib/utils";
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import { userService } from "@/modules/user/user.service";
|
||||
import { createErrorEmbed, createSuccessEmbed } from "@lib/embeds";
|
||||
import { UserError } from "@/lib/errors";
|
||||
import { userTimers, users } from "@/db/schema";
|
||||
import { eq, and, sql } from "drizzle-orm";
|
||||
import { DrizzleClient } from "@/lib/DrizzleClient";
|
||||
@@ -179,8 +180,12 @@ export const exam = createCommand({
|
||||
});
|
||||
|
||||
} catch (error: any) {
|
||||
console.error("Exam command error:", error);
|
||||
await interaction.editReply({ embeds: [createErrorEmbed("An error occurred while processing your exam.")] });
|
||||
if (error instanceof UserError) {
|
||||
await interaction.reply({ embeds: [createErrorEmbed(error.message)], ephemeral: true });
|
||||
} else {
|
||||
console.error("Error in exam command:", error);
|
||||
await interaction.reply({ embeds: [createErrorEmbed("An unexpected error occurred.")], ephemeral: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user