Removed older extension methods of errorhandler and errorpage
This commit is contained in:
parent
d96fbdba93
commit
5e2db0c585
|
|
@ -9,31 +9,8 @@ namespace Microsoft.AspNet.Builder
|
|||
/// <summary>
|
||||
/// IApplicationBuilder extension methods for the ErrorPageMiddleware.
|
||||
/// </summary>
|
||||
public static class ErrorPageExtensions
|
||||
public static class DeveloperExceptionPageExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Captures synchronous and asynchronous exceptions from the pipeline and generates HTML error responses.
|
||||
/// Full error details are only displayed by default if 'host.AppMode' is set to 'development' in the IApplicationBuilder.Properties.
|
||||
/// </summary>
|
||||
/// <param name="builder"></param>
|
||||
/// <returns></returns>
|
||||
public static IApplicationBuilder UseErrorPage([NotNull] this IApplicationBuilder builder)
|
||||
{
|
||||
return builder.UseErrorPage(new ErrorPageOptions());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Captures synchronous and asynchronous exceptions from the pipeline and generates HTML error responses.
|
||||
/// Full error details are only displayed by default if 'host.AppMode' is set to 'development' in the IApplicationBuilder.Properties.
|
||||
/// </summary>
|
||||
/// <param name="builder"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns></returns>
|
||||
public static IApplicationBuilder UseErrorPage([NotNull] this IApplicationBuilder builder, ErrorPageOptions options)
|
||||
{
|
||||
return builder.UseMiddleware<DeveloperExceptionPageMiddleware>(options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Captures synchronous and asynchronous exceptions from the pipeline and generates HTML error responses.
|
||||
/// Full error details are only displayed by default if 'host.AppMode' is set to 'development' in the IApplicationBuilder.Properties.
|
||||
|
|
|
|||
|
|
@ -9,41 +9,6 @@ namespace Microsoft.AspNet.Builder
|
|||
{
|
||||
public static class ExceptionHandlerExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds a middleware to the pipeline that will catch exceptions, log them, reset the request path, and re-execute the request.
|
||||
/// The request will not be re-executed if the response has already started.
|
||||
/// </summary>
|
||||
/// <param name="app"></param>
|
||||
/// <param name="errorHandlingPath"></param>
|
||||
/// <returns></returns>
|
||||
public static IApplicationBuilder UseErrorHandler(this IApplicationBuilder app, string errorHandlingPath)
|
||||
{
|
||||
var options = new ExceptionHandlerOptions()
|
||||
{
|
||||
ExceptionHandlingPath = new PathString(errorHandlingPath)
|
||||
};
|
||||
return app.UseMiddleware<ExceptionHandlerMiddleware>(options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a middleware to the pipeline that will catch exceptions, log them, and re-execute the request in an alternate pipeline.
|
||||
/// The request will not be re-executed if the response has already started.
|
||||
/// </summary>
|
||||
/// <param name="app"></param>
|
||||
/// <param name="configure"></param>
|
||||
/// <returns></returns>
|
||||
public static IApplicationBuilder UseErrorHandler(this IApplicationBuilder app, Action<IApplicationBuilder> configure)
|
||||
{
|
||||
var subAppBuilder = app.New();
|
||||
configure(subAppBuilder);
|
||||
var errorPipeline = subAppBuilder.Build();
|
||||
var options = new ExceptionHandlerOptions()
|
||||
{
|
||||
ExceptionHandler = errorPipeline
|
||||
};
|
||||
return app.UseMiddleware<ExceptionHandlerMiddleware>(options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a middleware to the pipeline that will catch exceptions, log them, reset the request path, and re-execute the request.
|
||||
/// The request will not be re-executed if the response has already started.
|
||||
|
|
|
|||
Loading…
Reference in New Issue