diff --git a/TaxBaik.Web/Logging/TelegramSink.cs b/TaxBaik.Web/Logging/TelegramSink.cs index 10f5318..f1fb30b 100644 --- a/TaxBaik.Web/Logging/TelegramSink.cs +++ b/TaxBaik.Web/Logging/TelegramSink.cs @@ -28,6 +28,20 @@ public class TelegramSink : ILogEventSink return; } + // Filter out harmless client disconnect and task cancellation exceptions + if (logEvent.Exception != null) + { + var exTypeName = logEvent.Exception.GetType().FullName ?? ""; + var exMessage = logEvent.Exception.Message ?? ""; + if (exTypeName.Contains("JSDisconnectedException") || + exTypeName.Contains("TaskCanceledException") || + exMessage.Contains("JavaScript interop calls cannot be issued") || + exMessage.Contains("circuit has disconnected")) + { + return; + } + } + // Emit is a synchronous method, so we dispatch the network call asynchronously Task.Run(async () => {