diff --git a/src/Rin/Middlewares/RequestRecorderMiddleware.cs b/src/Rin/Middlewares/RequestRecorderMiddleware.cs index e6bcc6a..f5bbac9 100644 --- a/src/Rin/Middlewares/RequestRecorderMiddleware.cs +++ b/src/Rin/Middlewares/RequestRecorderMiddleware.cs @@ -15,6 +15,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.Connections; namespace Rin.Middlewares { @@ -91,7 +92,13 @@ record = await PreprocessAsync(context, options, timelineRoot); } catch (Exception ex) { - _logger.LogError(ex, "Unhandled Exception was thrown until post-processing"); + var skipLogging = context.RequestAborted.IsCancellationRequested || + (ex is IOException && ex.InnerException is ConnectionAbortedException); + + if (!skipLogging) + { + _logger.LogError(ex, "Unhandled Exception was thrown until post-processing"); + } } } }