From e17ef89d72aa4146788f1e253452fa808f4eafb4 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Mon, 21 Mar 2022 19:17:46 +0000 Subject: [PATCH] Add proper error handling. --- bot/src/slashCommands/commands/profile.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bot/src/slashCommands/commands/profile.ts b/bot/src/slashCommands/commands/profile.ts index cd05ed106..39ada5d42 100644 --- a/bot/src/slashCommands/commands/profile.ts +++ b/bot/src/slashCommands/commands/profile.ts @@ -25,7 +25,12 @@ const command: SlashCommand = { return `Invalid userID. Can't query this!`; } - const userDoc = await GetUserInfo(userID); + let userDoc; + try { + userDoc = await GetUserInfo(userID); + } catch (err) { + return `This user does not exist.`; + } const { game, playtype } = ParseGPT(interaction.options.getString("game", true));