Skip to content

Commit

Permalink
Properly catch exceptions in note autocomplete handling
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed May 11, 2024
1 parent 3a7dd90 commit eea7b68
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Commands/InteractionCommands/UserNoteInteractions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public async Task RemoveUserNoteAsync(InteractionContext ctx,
{
note = JsonConvert.DeserializeObject<UserNote>(await Program.db.HashGetAsync(user.Id.ToString(), Convert.ToInt64(targetNote)));
}
catch (ArgumentNullException)
catch
{
await ctx.CreateResponseAsync(new DiscordInteractionResponseBuilder().WithContent($"{Program.cfgjson.Emoji.Error} I couldn't find that note! Make sure you've got the right ID.").AsEphemeral());
return;
Expand Down Expand Up @@ -88,7 +88,7 @@ public async Task EditUserNoteAsync(InteractionContext ctx,
{
note = JsonConvert.DeserializeObject<UserNote>(await Program.db.HashGetAsync(user.Id.ToString(), Convert.ToInt64(targetNote)));
}
catch (ArgumentNullException)
catch
{
await ctx.CreateResponseAsync(new DiscordInteractionResponseBuilder().WithContent($"{Program.cfgjson.Emoji.Error} I couldn't find that note! Make sure you've got the right ID.").AsEphemeral());
return;
Expand Down Expand Up @@ -146,7 +146,7 @@ public async Task ShowUserNoteAsync(InteractionContext ctx,
{
note = JsonConvert.DeserializeObject<UserNote>(await Program.db.HashGetAsync(user.Id.ToString(), Convert.ToInt64(targetNote)));
}
catch (ArgumentNullException)
catch
{
await ctx.CreateResponseAsync(new DiscordInteractionResponseBuilder().WithContent($"{Program.cfgjson.Emoji.Error} I couldn't find that note! Make sure you've got the right ID.").AsEphemeral());
return;
Expand Down

0 comments on commit eea7b68

Please sign in to comment.