Remove ErrorPageOptions

This commit is contained in:
Pranav K 2015-12-15 11:07:16 -08:00
parent 2baf6fecf5
commit e384b7d4d0
6 changed files with 12 additions and 41 deletions

View File

@ -30,11 +30,11 @@ namespace Microsoft.AspNet.Builder
/// Captures synchronous and asynchronous <see cref="Exception"/> instances from the pipeline and generates HTML error responses.
/// </summary>
/// <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>
public static IApplicationBuilder UseDeveloperExceptionPage(
this IApplicationBuilder builder,
Action<ErrorPageOptions> configureOptions)
Action<DeveloperExceptionPageOptions> configureOptions)
{
if (builder == null)
{
@ -46,7 +46,7 @@ namespace Microsoft.AspNet.Builder
throw new ArgumentNullException(nameof(configureOptions));
}
var options = new ErrorPageOptions();
var options = new DeveloperExceptionPageOptions();
configureOptions(options);
return builder.UseMiddleware<DeveloperExceptionPageMiddleware>(options);
}

View File

@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Diagnostics
public class DeveloperExceptionPageMiddleware
{
private readonly RequestDelegate _next;
private readonly ErrorPageOptions _options;
private readonly DeveloperExceptionPageOptions _options;
private static readonly bool IsMono = Type.GetType("Mono.Runtime") != null;
private readonly ILogger _logger;
private readonly IFileProvider _fileProvider;
@ -37,7 +37,7 @@ namespace Microsoft.AspNet.Diagnostics
/// <param name="options"></param>
public DeveloperExceptionPageMiddleware(
RequestDelegate next,
ErrorPageOptions options,
DeveloperExceptionPageOptions options,
ILoggerFactory loggerFactory,
IApplicationEnvironment appEnvironment,
DiagnosticSource diagnosticSource)

View File

@ -6,36 +6,7 @@ using Microsoft.AspNet.FileProviders;
namespace Microsoft.AspNet.Diagnostics
{
/// <summary>
/// Options for the ErrorPageMiddleware.
/// </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.
/// Options for the <see cref="DeveloperExceptionPageMiddleware"/>.
/// </summary>
public class DeveloperExceptionPageOptions
{

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Diagnostics.Views
/// <summary>
/// Options for what output to display.
/// </summary>
public ErrorPageOptions Options { get; set; }
public DeveloperExceptionPageOptions Options { get; set; }
/// <summary>
/// Detailed information about each parse or compilation error.

View File

@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Diagnostics.Views
/// <summary>
/// Options for what output to display.
/// </summary>
public ErrorPageOptions Options { get; set; }
public DeveloperExceptionPageOptions Options { get; set; }
/// <summary>
/// Detailed information about each exception in the stack.

View File

@ -293,17 +293,17 @@ namespace Microsoft.AspNet.Diagnostics
private DeveloperExceptionPageMiddleware GetErrorPageMiddleware(
IFileProvider fileProvider = null, int sourceCodeLineCount = 6)
{
var errorPageOptions = new ErrorPageOptions();
errorPageOptions.SourceCodeLineCount = sourceCodeLineCount;
var options = new DeveloperExceptionPageOptions();
options.SourceCodeLineCount = sourceCodeLineCount;
if (fileProvider != null)
{
errorPageOptions.FileProvider = fileProvider;
options.FileProvider = fileProvider;
}
var middleware = new DeveloperExceptionPageMiddleware(
(httpContext) => { return Task.FromResult(0); },
errorPageOptions,
options,
new LoggerFactory(),
new TestApplicationEnvironment(),
new DiagnosticListener("Microsoft.Aspnet"));