From 75e586cee81d9bc89ce1563bf86d9ef2ec837b0f Mon Sep 17 00:00:00 2001 From: syntaxbullet Date: Mon, 22 Dec 2025 12:56:37 +0100 Subject: [PATCH] feat(commands): improve error feedback for use command --- src/commands/inventory/use.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) => {