Added IExceptionHandlerPathFeature interface.
This commit is contained in:
parent
c037a577b0
commit
3a868d87a2
|
|
@ -0,0 +1,17 @@
|
|||
// 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.
|
||||
|
||||
namespace Microsoft.AspNetCore.Diagnostics
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an exception handler with the original path of the request.
|
||||
/// </summary>
|
||||
public interface IExceptionHandlerPathFeature : IExceptionHandlerFeature
|
||||
{
|
||||
/// <summary>
|
||||
/// The portion of the request path that identifies the requested resource. The value
|
||||
/// is un-escaped.
|
||||
/// </summary>
|
||||
string Path { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -5,8 +5,10 @@ using System;
|
|||
|
||||
namespace Microsoft.AspNetCore.Diagnostics
|
||||
{
|
||||
public class ExceptionHandlerFeature : IExceptionHandlerFeature
|
||||
public class ExceptionHandlerFeature : IExceptionHandlerPathFeature
|
||||
{
|
||||
public Exception Error { get; set; }
|
||||
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -22,8 +22,8 @@ namespace Microsoft.AspNetCore.Diagnostics
|
|||
private readonly DiagnosticSource _diagnosticSource;
|
||||
|
||||
public ExceptionHandlerMiddleware(
|
||||
RequestDelegate next,
|
||||
ILoggerFactory loggerFactory,
|
||||
RequestDelegate next,
|
||||
ILoggerFactory loggerFactory,
|
||||
IOptions<ExceptionHandlerOptions> options,
|
||||
DiagnosticSource diagnosticSource)
|
||||
{
|
||||
|
|
@ -65,8 +65,10 @@ namespace Microsoft.AspNetCore.Diagnostics
|
|||
var exceptionHandlerFeature = new ExceptionHandlerFeature()
|
||||
{
|
||||
Error = ex,
|
||||
Path = originalPath.Value,
|
||||
};
|
||||
context.Features.Set<IExceptionHandlerFeature>(exceptionHandlerFeature);
|
||||
context.Features.Set<IExceptionHandlerPathFeature>(exceptionHandlerFeature);
|
||||
context.Response.StatusCode = 500;
|
||||
context.Response.OnStarting(_clearCacheHeadersDelegate, context.Response);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue