/// <summary> /// Attaches the <see cref="ExceptionMiddleware"/> middleware to the specified <paramref name="builder"/>. /// </summary> /// <param name="builder">The IApplicationBuilder instance to configure.</param> /// <param name="configureOptions">The options for the middleware.</param> /// <returns>The modified IApplicationBuilder instance.</returns> public static IApplicationBuilder UseExceptionMiddleware(this IApplicationBuilder builder, Action <ExceptionMiddlewareOptions> configureOptions = null) { var options = new ExceptionMiddlewareOptions(); configureOptions?.Invoke(options); return(builder.UseMiddleware <ExceptionMiddleware>(options)); }