Merge pull request #6 from StevanFreeborn/stevanfreeborn/chore/modify-logging
chore: log warning instead of error and log additional details if web socket exception occurred
This commit is contained in:
@@ -224,7 +224,17 @@ internal sealed class DiscordGatewayClient : IDiscordGatewayClient
|
||||
catch (Exception ex)
|
||||
#pragma warning restore CA1031 // Do not catch general exception types
|
||||
{
|
||||
_logger.LogError(ex, "Unexpected error while receiving messages");
|
||||
_logger.LogWarning(ex, "Unexpected error while receiving messages");
|
||||
|
||||
if (ex is WebSocketException wse)
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"WebSocket error: {Message} - {ErrorCode} - {WebSocketErrorCode}",
|
||||
wse.Message,
|
||||
wse.ErrorCode,
|
||||
wse.WebSocketErrorCode
|
||||
);
|
||||
}
|
||||
|
||||
_logger.LogWarning("Closing connection and invalidating session.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user