// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.AspNet.Diagnostics; namespace Microsoft.AspNet.Builder { /// /// extension methods for the . /// public static class DeveloperExceptionPageExtensions { /// /// Captures synchronous and asynchronous instances from the pipeline and generates HTML error responses. /// /// The . /// A reference to the after the operation has completed. public static IApplicationBuilder UseDeveloperExceptionPage(this IApplicationBuilder app) { if (app == null) { throw new ArgumentNullException(nameof(app)); } return app.UseDeveloperExceptionPage(options => { }); } /// /// Captures synchronous and asynchronous instances from the pipeline and generates HTML error responses. /// /// The . /// A callback to configure . /// A reference to the after the operation has completed. public static IApplicationBuilder UseDeveloperExceptionPage( this IApplicationBuilder app, Action configureOptions) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (configureOptions == null) { throw new ArgumentNullException(nameof(configureOptions)); } var options = new DeveloperExceptionPageOptions(); configureOptions(options); return app.UseMiddleware(options); } /// /// Captures synchronous and asynchronous instances from the pipeline and generates HTML error responses. /// /// The . /// A that specifies options for the middleware. /// A reference to the after the operation has completed. public static IApplicationBuilder UseDeveloperExceptionPage( this IApplicationBuilder app, DeveloperExceptionPageOptions options) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } return app.UseMiddleware(options); } } }