From 8227d70b8610ccc7e2dbe2ba4fceba778666dfa4 Mon Sep 17 00:00:00 2001 From: Mihail Gribkov <61027276+Misha-133@users.noreply.github.com> Date: Tue, 26 Dec 2023 14:08:52 +0300 Subject: [PATCH] fix exception not being logged (#2800) --- src/Discord.Net.WebSocket/DiscordSocketClient.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs index 9641145b..c6b132e1 100644 --- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs +++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs @@ -648,7 +648,6 @@ namespace Discord.WebSocket if (ConnectionState == ConnectionState.Connected) { EnsureGatewayIntent(GatewayIntents.GuildMembers); - //Race condition leads to guilds being requested twice, probably okay return ProcessUserDownloadsAsync(guilds.Select(x => GetGuild(x.Id)).Where(x => x != null)); } @@ -997,7 +996,14 @@ namespace Discord.WebSocket return; if (BaseConfig.AlwaysDownloadUsers) - _ = DownloadUsersAsync(Guilds.Where(x => x.IsAvailable && !x.HasAllMembers)); + try + { + _ = DownloadUsersAsync(Guilds.Where(x => x.IsAvailable && !x.HasAllMembers)); + } + catch (Exception ex) + { + await _gatewayLogger.WarningAsync(ex); + } await TimedInvokeAsync(_readyEvent, nameof(Ready)).ConfigureAwait(false); await _gatewayLogger.InfoAsync("Ready").ConfigureAwait(false);