diff --git a/src/commands/inventory/use.ts b/src/commands/inventory/use.ts index 3283782..155ddcf 100644 --- a/src/commands/inventory/use.ts +++ b/src/commands/inventory/use.ts @@ -7,6 +7,7 @@ import { inventory, items } from "@/db/schema"; import { eq, and, like } from "drizzle-orm"; import { DrizzleClient } from "@/lib/DrizzleClient"; import type { ItemUsageData } from "@/lib/types"; +import { UserError } from "@/lib/errors"; export const use = createCommand({ data: new SlashCommandBuilder() @@ -53,7 +54,12 @@ export const use = createCommand({ await interaction.editReply({ embeds: [embed] }); } catch (error: any) { - await interaction.editReply({ embeds: [createErrorEmbed(error.message)] }); + if (error instanceof UserError) { + await interaction.editReply({ embeds: [createErrorEmbed(error.message)] }); + } else { + console.error("Error using item:", error); + await interaction.editReply({ embeds: [createErrorEmbed("An unexpected error occurred while using the item.")] }); + } } }, autocomplete: async (interaction) => {