public static IApplicationBuilder UseApiExceptionHandler(
            this IApplicationBuilder builder,
            Action <ApiExceptionHandlerOptions> configureOptions)
        {
            var options = new ApiExceptionHandlerOptions();

            configureOptions(options);
            return(builder.UseMiddleware <ApiExceptionHandlerMiddleware>(options));
        }
Example #2
0
 public ApiExceptionHandlerMiddleware(
     RequestDelegate next,
     ILogger <ApiExceptionHandlerMiddleware> logger,
     ApiExceptionHandlerOptions options)
 {
     _next    = next;
     _logger  = logger;
     _options = options;
 }