From fbe14c1ef55a14abd8532b78c38402df7bdd347a Mon Sep 17 00:00:00 2001 From: FloatingMilkshake Date: Sat, 30 Nov 2024 14:12:03 -0500 Subject: [PATCH] Channel update event handler: log ArgumentExceptions in more detail --- Tasks/EventTasks.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Tasks/EventTasks.cs b/Tasks/EventTasks.cs index cad8dc6e..cb02f882 100644 --- a/Tasks/EventTasks.cs +++ b/Tasks/EventTasks.cs @@ -111,7 +111,18 @@ await Program.db.HashSetAsync("overrides", userOverwrites.Name, if (dict is not null) { - dict.Add(e.ChannelAfter.Id, overwrite); + try + { + dict.Add(e.ChannelAfter.Id, overwrite); + } + catch (ArgumentException ex) + { + Program.discord.Logger.LogWarning(ex, "Failed to process pending channel update event for channel {channel}: failed to add overwrite with ID {id} to db", e.ChannelAfter.Id, overwrite.Id); + + // Skip this overwrite + PendingChannelUpdateEvents.Remove(timestamp); + continue; + } if (dict.Count > 0) await Program.db.HashSetAsync("overrides", overwrite.Id,