/// <summary> /// Добавляет прослойку перехвата исключений. /// </summary> /// <param name="application"></param> /// <returns></returns> public static IApplicationBuilder UseHttpExceptionHandling(this IApplicationBuilder application, Action <HttpExceptionHandlerOptions> configureOptions = null) { ArgumentNullException.ThrowIfNull(application); HttpExceptionHandlerOptions options = new HttpExceptionHandlerOptions(); configureOptions?.Invoke(options); return(application.UseMiddleware <HttpExceptionHandler>(options)); }
public HttpExceptionHandler(RequestDelegate next, HttpExceptionHandlerOptions options) { _next = next ?? throw new ArgumentNullException(nameof(next)); _options = options ?? throw new ArgumentNullException(nameof(options)); }