Skip to content

Commit

Permalink
Channel update event handler: log ArgumentExceptions in more detail
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Nov 30, 2024
1 parent 8193769 commit fbe14c1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Tasks/EventTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fbe14c1

Please sign in to comment.