Remove ErrorPageOptions
This commit is contained in:
parent
2baf6fecf5
commit
e384b7d4d0
|
|
@ -30,11 +30,11 @@ namespace Microsoft.AspNet.Builder
|
||||||
/// Captures synchronous and asynchronous <see cref="Exception"/> instances from the pipeline and generates HTML error responses.
|
/// Captures synchronous and asynchronous <see cref="Exception"/> instances from the pipeline and generates HTML error responses.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="builder">The <see cref="IApplicationBuilder"/>.</param>
|
/// <param name="builder">The <see cref="IApplicationBuilder"/>.</param>
|
||||||
/// <param name="configureOptions">A callback to configure <see cref="ErrorPageOptions"/>.</param>
|
/// <param name="configureOptions">A callback to configure <see cref="DeveloperExceptionPageOptions"/>.</param>
|
||||||
/// <returns>A reference to the <paramref name="builder"/> after the operation has completed.</returns>
|
/// <returns>A reference to the <paramref name="builder"/> after the operation has completed.</returns>
|
||||||
public static IApplicationBuilder UseDeveloperExceptionPage(
|
public static IApplicationBuilder UseDeveloperExceptionPage(
|
||||||
this IApplicationBuilder builder,
|
this IApplicationBuilder builder,
|
||||||
Action<ErrorPageOptions> configureOptions)
|
Action<DeveloperExceptionPageOptions> configureOptions)
|
||||||
{
|
{
|
||||||
if (builder == null)
|
if (builder == null)
|
||||||
{
|
{
|
||||||
|
|
@ -46,7 +46,7 @@ namespace Microsoft.AspNet.Builder
|
||||||
throw new ArgumentNullException(nameof(configureOptions));
|
throw new ArgumentNullException(nameof(configureOptions));
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = new ErrorPageOptions();
|
var options = new DeveloperExceptionPageOptions();
|
||||||
configureOptions(options);
|
configureOptions(options);
|
||||||
return builder.UseMiddleware<DeveloperExceptionPageMiddleware>(options);
|
return builder.UseMiddleware<DeveloperExceptionPageMiddleware>(options);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Diagnostics
|
||||||
public class DeveloperExceptionPageMiddleware
|
public class DeveloperExceptionPageMiddleware
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate _next;
|
private readonly RequestDelegate _next;
|
||||||
private readonly ErrorPageOptions _options;
|
private readonly DeveloperExceptionPageOptions _options;
|
||||||
private static readonly bool IsMono = Type.GetType("Mono.Runtime") != null;
|
private static readonly bool IsMono = Type.GetType("Mono.Runtime") != null;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IFileProvider _fileProvider;
|
private readonly IFileProvider _fileProvider;
|
||||||
|
|
@ -37,7 +37,7 @@ namespace Microsoft.AspNet.Diagnostics
|
||||||
/// <param name="options"></param>
|
/// <param name="options"></param>
|
||||||
public DeveloperExceptionPageMiddleware(
|
public DeveloperExceptionPageMiddleware(
|
||||||
RequestDelegate next,
|
RequestDelegate next,
|
||||||
ErrorPageOptions options,
|
DeveloperExceptionPageOptions options,
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
IApplicationEnvironment appEnvironment,
|
IApplicationEnvironment appEnvironment,
|
||||||
DiagnosticSource diagnosticSource)
|
DiagnosticSource diagnosticSource)
|
||||||
|
|
|
||||||
|
|
@ -6,36 +6,7 @@ using Microsoft.AspNet.FileProviders;
|
||||||
namespace Microsoft.AspNet.Diagnostics
|
namespace Microsoft.AspNet.Diagnostics
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Options for the ErrorPageMiddleware.
|
/// Options for the <see cref="DeveloperExceptionPageMiddleware"/>.
|
||||||
/// </summary>
|
|
||||||
public class ErrorPageOptions
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Create an instance with the default options settings.
|
|
||||||
/// </summary>
|
|
||||||
public ErrorPageOptions()
|
|
||||||
{
|
|
||||||
SourceCodeLineCount = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines how many lines of code to include before and after the line of code
|
|
||||||
/// present in an exception's stack frame. Only applies when symbols are available and
|
|
||||||
/// source code referenced by the exception stack trace is present on the server.
|
|
||||||
/// </summary>
|
|
||||||
public int SourceCodeLineCount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Provides files containing source code used to display contextual information of an exception.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// If <c>null</c> <see cref="DeveloperExceptionPageMiddleware" /> will use a <see cref="PhysicalFileProvider"/>.
|
|
||||||
/// </remarks>
|
|
||||||
public IFileProvider FileProvider { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Options for the DeveloperExceptionPageMiddleware.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DeveloperExceptionPageOptions
|
public class DeveloperExceptionPageOptions
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Diagnostics.Views
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Options for what output to display.
|
/// Options for what output to display.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ErrorPageOptions Options { get; set; }
|
public DeveloperExceptionPageOptions Options { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Detailed information about each parse or compilation error.
|
/// Detailed information about each parse or compilation error.
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Diagnostics.Views
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Options for what output to display.
|
/// Options for what output to display.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ErrorPageOptions Options { get; set; }
|
public DeveloperExceptionPageOptions Options { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Detailed information about each exception in the stack.
|
/// Detailed information about each exception in the stack.
|
||||||
|
|
|
||||||
|
|
@ -293,17 +293,17 @@ namespace Microsoft.AspNet.Diagnostics
|
||||||
private DeveloperExceptionPageMiddleware GetErrorPageMiddleware(
|
private DeveloperExceptionPageMiddleware GetErrorPageMiddleware(
|
||||||
IFileProvider fileProvider = null, int sourceCodeLineCount = 6)
|
IFileProvider fileProvider = null, int sourceCodeLineCount = 6)
|
||||||
{
|
{
|
||||||
var errorPageOptions = new ErrorPageOptions();
|
var options = new DeveloperExceptionPageOptions();
|
||||||
errorPageOptions.SourceCodeLineCount = sourceCodeLineCount;
|
options.SourceCodeLineCount = sourceCodeLineCount;
|
||||||
|
|
||||||
if (fileProvider != null)
|
if (fileProvider != null)
|
||||||
{
|
{
|
||||||
errorPageOptions.FileProvider = fileProvider;
|
options.FileProvider = fileProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
var middleware = new DeveloperExceptionPageMiddleware(
|
var middleware = new DeveloperExceptionPageMiddleware(
|
||||||
(httpContext) => { return Task.FromResult(0); },
|
(httpContext) => { return Task.FromResult(0); },
|
||||||
errorPageOptions,
|
options,
|
||||||
new LoggerFactory(),
|
new LoggerFactory(),
|
||||||
new TestApplicationEnvironment(),
|
new TestApplicationEnvironment(),
|
||||||
new DiagnosticListener("Microsoft.Aspnet"));
|
new DiagnosticListener("Microsoft.Aspnet"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue