Saving
This commit is contained in:
1 parent
9719a0c0fd
commit
1e66851113
146 files changed
+738
-382
No files matched your search
@@ -0,0 +1,23 @@
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
||||
namespace PrivaPub.Extensions
|
||||
{
|
||||
public class OperationCancelledExceptionFilter : ExceptionFilterAttribute
|
||||
{
|
||||
readonly Serilog.ILogger Logger;
|
||||
|
||||
public OperationCancelledExceptionFilter(Serilog.ILogger logger) =>
|
||||
Logger = logger.ForContext<OperationCancelledExceptionFilter>();
|
||||
|
||||
public override void OnException(ExceptionContext context)
|
||||
{
|
||||
if (context.Exception is not OperationCanceledException) return;
|
||||
|
||||
Logger.Information($"Request for {context.HttpContext.Request.Path} was cancelled.");
|
||||
context.ExceptionHandled = true;
|
||||
context.Result = new StatusCodeResult(499);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user