diff --git a/samples/ErrorHandlerSample/Startup.cs b/samples/ErrorHandlerSample/Startup.cs
index 3609affc6a..3ebc4e2d57 100644
--- a/samples/ErrorHandlerSample/Startup.cs
+++ b/samples/ErrorHandlerSample/Startup.cs
@@ -12,7 +12,7 @@ namespace ErrorHandlerSample
public void Configure(IApplicationBuilder app)
{
// Configure the error handler to show an error page.
- app.UseErrorHandler(errorApp =>
+ app.UseExceptionHandler(errorApp =>
{
// Normally you'd use MVC or similar to render a nice page.
errorApp.Run(async context =>
diff --git a/samples/ErrorPageSample/Startup.cs b/samples/ErrorPageSample/Startup.cs
index e845ce8bcd..0352d8856b 100644
--- a/samples/ErrorPageSample/Startup.cs
+++ b/samples/ErrorPageSample/Startup.cs
@@ -7,7 +7,7 @@ namespace ErrorPageSample
{
public void Configure(IApplicationBuilder app)
{
- app.UseErrorPage();
+ app.UseDeveloperExceptionPage();
app.Run(context =>
{
throw new Exception(string.Concat(
diff --git a/samples/StatusCodePagesSample/Startup.cs b/samples/StatusCodePagesSample/Startup.cs
index f94deae4fb..4dfa37f284 100644
--- a/samples/StatusCodePagesSample/Startup.cs
+++ b/samples/StatusCodePagesSample/Startup.cs
@@ -17,7 +17,7 @@ namespace StatusCodePagesSample
{
public void Configure(IApplicationBuilder app)
{
- app.UseErrorPage();
+ app.UseDeveloperExceptionPage();
app.UseStatusCodePages(); // There is a default response but any of the following can be used to change the behavior.
// app.UseStatusCodePages(context => context.HttpContext.Response.SendAsync("Handler, status code: " + context.HttpContext.Response.StatusCode, "text/plain"));
diff --git a/src/Microsoft.AspNet.Diagnostics/DeveloperExceptionPageExtensions.cs b/src/Microsoft.AspNet.Diagnostics/DeveloperExceptionPageExtensions.cs
new file mode 100644
index 0000000000..ca91244237
--- /dev/null
+++ b/src/Microsoft.AspNet.Diagnostics/DeveloperExceptionPageExtensions.cs
@@ -0,0 +1,60 @@
+// 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 Microsoft.AspNet.Diagnostics;
+using Microsoft.Framework.Internal;
+
+namespace Microsoft.AspNet.Builder
+{
+ ///
+ /// IApplicationBuilder extension methods for the ErrorPageMiddleware.
+ ///
+ public static class ErrorPageExtensions
+ {
+ /////
+ ///// 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.
+ /////
+ /////
+ /////
+ //public static IApplicationBuilder UseErrorPage([NotNull] this IApplicationBuilder builder)
+ //{
+ // return builder.UseErrorPage(new ErrorPageOptions());
+ //}
+
+ /////
+ ///// 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.
+ /////
+ /////
+ /////
+ /////
+ //public static IApplicationBuilder UseErrorPage([NotNull] this IApplicationBuilder builder, ErrorPageOptions options)
+ //{
+ // return builder.UseMiddleware(options);
+ //}
+
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ public static IApplicationBuilder UseDeveloperExceptionPage([NotNull] this IApplicationBuilder builder)
+ {
+ return builder.UseDeveloperExceptionPage(new ErrorPageOptions());
+ }
+
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ public static IApplicationBuilder UseDeveloperExceptionPage([NotNull] this IApplicationBuilder builder, ErrorPageOptions options)
+ {
+ return builder.UseMiddleware(options);
+ }
+ }
+}
diff --git a/src/Microsoft.AspNet.Diagnostics/ErrorHandlerExtensions.cs b/src/Microsoft.AspNet.Diagnostics/ErrorHandlerExtensions.cs
deleted file mode 100644
index 6a8ce6e7e9..0000000000
--- a/src/Microsoft.AspNet.Diagnostics/ErrorHandlerExtensions.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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;
-using Microsoft.AspNet.Http;
-
-namespace Microsoft.AspNet.Builder
-{
- public static class ErrorHandlerExtensions
- {
- ///
- /// 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.
- ///
- ///
- ///
- ///
- public static IApplicationBuilder UseErrorHandler(this IApplicationBuilder app, string errorHandlingPath)
- {
- var options = new ErrorHandlerOptions()
- {
- ErrorHandlingPath = new PathString(errorHandlingPath)
- };
- return app.UseMiddleware(options);
- }
-
- ///
- /// 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.
- ///
- ///
- ///
- ///
- public static IApplicationBuilder UseErrorHandler(this IApplicationBuilder app, Action configure)
- {
- var subAppBuilder = app.New();
- configure(subAppBuilder);
- var errorPipeline = subAppBuilder.Build();
- var options = new ErrorHandlerOptions()
- {
- ErrorHandler = errorPipeline
- };
- return app.UseMiddleware(options);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Diagnostics/ErrorPageExtensions.cs b/src/Microsoft.AspNet.Diagnostics/ErrorPageExtensions.cs
deleted file mode 100644
index 5696387521..0000000000
--- a/src/Microsoft.AspNet.Diagnostics/ErrorPageExtensions.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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 Microsoft.AspNet.Diagnostics;
-using Microsoft.Framework.Internal;
-
-namespace Microsoft.AspNet.Builder
-{
- ///
- /// IApplicationBuilder extension methods for the ErrorPageMiddleware.
- ///
- public static class ErrorPageExtensions
- {
- ///
- /// 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.
- ///
- ///
- ///
- public static IApplicationBuilder UseErrorPage([NotNull] this IApplicationBuilder builder)
- {
- return builder.UseErrorPage(new ErrorPageOptions());
- }
-
- ///
- /// 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.
- ///
- ///
- ///
- ///
- public static IApplicationBuilder UseErrorPage([NotNull] this IApplicationBuilder builder, ErrorPageOptions options)
- {
- return builder.UseMiddleware(options);
- }
- }
-}
diff --git a/src/Microsoft.AspNet.Diagnostics/ErrorPageMiddleware.cs b/src/Microsoft.AspNet.Diagnostics/ErrorPageMiddleware.cs
index 2ee5df78b9..b635784bce 100644
--- a/src/Microsoft.AspNet.Diagnostics/ErrorPageMiddleware.cs
+++ b/src/Microsoft.AspNet.Diagnostics/ErrorPageMiddleware.cs
@@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Diagnostics
///
/// Captures synchronous and asynchronous exceptions from the pipeline and generates HTML error responses.
///
- public class ErrorPageMiddleware
+ public class DeveloperExceptionPageMiddleware
{
private readonly RequestDelegate _next;
private readonly ErrorPageOptions _options;
@@ -33,11 +33,11 @@ namespace Microsoft.AspNet.Diagnostics
private readonly IFileProvider _fileProvider;
///
- /// Initializes a new instance of the class
+ /// Initializes a new instance of the class
///
///
///
- public ErrorPageMiddleware(
+ public DeveloperExceptionPageMiddleware(
[NotNull] RequestDelegate next,
[NotNull] ErrorPageOptions options,
ILoggerFactory loggerFactory,
@@ -45,7 +45,7 @@ namespace Microsoft.AspNet.Diagnostics
{
_next = next;
_options = options;
- _logger = loggerFactory.CreateLogger();
+ _logger = loggerFactory.CreateLogger();
_fileProvider = options.FileProvider ?? new PhysicalFileProvider(appEnvironment.ApplicationBasePath);
}
diff --git a/src/Microsoft.AspNet.Diagnostics/ErrorPageOptions.cs b/src/Microsoft.AspNet.Diagnostics/ErrorPageOptions.cs
index 5db1e0c46f..2c7da7078b 100644
--- a/src/Microsoft.AspNet.Diagnostics/ErrorPageOptions.cs
+++ b/src/Microsoft.AspNet.Diagnostics/ErrorPageOptions.cs
@@ -30,7 +30,7 @@ namespace Microsoft.AspNet.Diagnostics
/// Provides files containing source code used to display contextual information of an exception.
///
///
- /// If null will use a .
+ /// If null will use a .
///
public IFileProvider FileProvider { get; set; }
}
diff --git a/src/Microsoft.AspNet.Diagnostics/ExceptionHandlerExtensions.cs b/src/Microsoft.AspNet.Diagnostics/ExceptionHandlerExtensions.cs
new file mode 100644
index 0000000000..67d2c1c54d
--- /dev/null
+++ b/src/Microsoft.AspNet.Diagnostics/ExceptionHandlerExtensions.cs
@@ -0,0 +1,82 @@
+// 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;
+using Microsoft.AspNet.Http;
+
+namespace Microsoft.AspNet.Builder
+{
+ public static class ExceptionHandlerExtensions
+ {
+ /////
+ ///// 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.
+ /////
+ /////
+ /////
+ /////
+ //public static IApplicationBuilder UseErrorHandler(this IApplicationBuilder app, string errorHandlingPath)
+ //{
+ // var options = new ErrorHandlerOptions()
+ // {
+ // ErrorHandlingPath = new PathString(errorHandlingPath)
+ // };
+ // return app.UseMiddleware(options);
+ //}
+
+ /////
+ ///// 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.
+ /////
+ /////
+ /////
+ /////
+ //public static IApplicationBuilder UseErrorHandler(this IApplicationBuilder app, Action configure)
+ //{
+ // var subAppBuilder = app.New();
+ // configure(subAppBuilder);
+ // var errorPipeline = subAppBuilder.Build();
+ // var options = new ErrorHandlerOptions()
+ // {
+ // ErrorHandler = errorPipeline
+ // };
+ // return app.UseMiddleware(options);
+ //}
+
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ public static IApplicationBuilder UseExceptionHandler(this IApplicationBuilder app, string errorHandlingPath)
+ {
+ var options = new ErrorHandlerOptions()
+ {
+ ErrorHandlingPath = new PathString(errorHandlingPath)
+ };
+ return app.UseMiddleware(options);
+ }
+
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ public static IApplicationBuilder UseExceptionHandler(this IApplicationBuilder app, Action configure)
+ {
+ var subAppBuilder = app.New();
+ configure(subAppBuilder);
+ var errorPipeline = subAppBuilder.Build();
+ var options = new ErrorHandlerOptions()
+ {
+ ErrorHandler = errorPipeline
+ };
+ return app.UseMiddleware(options);
+ }
+ }
+}
\ No newline at end of file
diff --git a/test/Microsoft.AspNet.Diagnostics.Tests/ErrorHandlerTest.cs b/test/Microsoft.AspNet.Diagnostics.Tests/ErrorHandlerTest.cs
index a0f051dc7b..dc154408a9 100644
--- a/test/Microsoft.AspNet.Diagnostics.Tests/ErrorHandlerTest.cs
+++ b/test/Microsoft.AspNet.Diagnostics.Tests/ErrorHandlerTest.cs
@@ -26,7 +26,7 @@ namespace Microsoft.AspNet.Diagnostics
{
using (var server = TestServer.Create(app =>
{
- app.UseErrorHandler("/handle-errors");
+ app.UseExceptionHandler("/handle-errors");
app.Map("/handle-errors", (innerAppBuilder) =>
{
@@ -72,7 +72,7 @@ namespace Microsoft.AspNet.Diagnostics
Assert.Equal("Something bad happened", exception.Message);
});
- app.UseErrorHandler("/handle-errors");
+ app.UseExceptionHandler("/handle-errors");
app.Map("/handle-errors", (innerAppBuilder) =>
{
@@ -124,7 +124,7 @@ namespace Microsoft.AspNet.Diagnostics
}
});
- app.UseErrorHandler("/handle-errors");
+ app.UseExceptionHandler("/handle-errors");
app.Map("/handle-errors", (innerAppBuilder) =>
{
@@ -171,7 +171,7 @@ namespace Microsoft.AspNet.Diagnostics
var expectedResponseBody = "Handled error in a custom way.";
using (var server = TestServer.Create(app =>
{
- app.UseErrorHandler("/handle-errors");
+ app.UseExceptionHandler("/handle-errors");
app.Map("/handle-errors", (innerAppBuilder) =>
{
@@ -218,7 +218,7 @@ namespace Microsoft.AspNet.Diagnostics
var expectedResponseBody = "Hello world!";
using (var server = TestServer.Create(app =>
{
- app.UseErrorHandler("/handle-errors");
+ app.UseExceptionHandler("/handle-errors");
app.Map("/handle-errors", (innerAppBuilder) =>
{
@@ -281,7 +281,7 @@ namespace Microsoft.AspNet.Diagnostics
Assert.Equal("Something bad happened", exception.Message);
});
- app.UseErrorHandler("/handle-errors");
+ app.UseExceptionHandler("/handle-errors");
app.Map("/handle-errors", (innerAppBuilder) =>
{
diff --git a/test/Microsoft.AspNet.Diagnostics.Tests/ErrorPageMiddlewareTest.cs b/test/Microsoft.AspNet.Diagnostics.Tests/ErrorPageMiddlewareTest.cs
index 00f8e4fedb..c0e354d771 100644
--- a/test/Microsoft.AspNet.Diagnostics.Tests/ErrorPageMiddlewareTest.cs
+++ b/test/Microsoft.AspNet.Diagnostics.Tests/ErrorPageMiddlewareTest.cs
@@ -283,7 +283,7 @@ namespace Microsoft.AspNet.Diagnostics
return Enumerable.Range(start, count).Select(i => string.Format("Line{0}", i));
}
- private ErrorPageMiddleware GetErrorPageMiddleware(
+ private DeveloperExceptionPageMiddleware GetErrorPageMiddleware(
IFileProvider fileProvider = null, int sourceCodeLineCount = 6)
{
var errorPageOptions = new ErrorPageOptions();
@@ -294,7 +294,7 @@ namespace Microsoft.AspNet.Diagnostics
errorPageOptions.FileProvider = fileProvider;
}
- var middleware = new ErrorPageMiddleware(
+ var middleware = new DeveloperExceptionPageMiddleware(
(httpContext) => { return Task.FromResult(0); },
errorPageOptions,
new LoggerFactory(),