Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Commit

Permalink
Don't use Exception as ExceptionHandled
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbrandenburg committed Jun 8, 2016
1 parent 74e2c04 commit d57f2d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ private async Task InvokeExceptionFilterAsync()
await InvokeExceptionFilterAsync();

Debug.Assert(_exceptionContext != null);
if (_exceptionContext.Exception != null)
if (_exceptionContext.Exception != null && !_exceptionContext.ExceptionHandled)
{
_diagnosticSource.BeforeOnExceptionAsync(_exceptionContext, current.FilterAsync);

Expand All @@ -422,7 +422,7 @@ private async Task InvokeExceptionFilterAsync()

_diagnosticSource.AfterOnExceptionAsync(_exceptionContext, current.FilterAsync);

if (_exceptionContext.Exception == null)
if (_exceptionContext.ExceptionHandled)
{
_logger.ExceptionFilterShortCircuited(current.FilterAsync);
}
Expand All @@ -435,7 +435,7 @@ private async Task InvokeExceptionFilterAsync()
await InvokeExceptionFilterAsync();

Debug.Assert(_exceptionContext != null);
if (_exceptionContext.Exception != null)
if (_exceptionContext.Exception != null && !_exceptionContext.ExceptionHandled)
{
_diagnosticSource.BeforeOnException(_exceptionContext, current.Filter);

Expand All @@ -445,7 +445,7 @@ private async Task InvokeExceptionFilterAsync()

_diagnosticSource.AfterOnException(_exceptionContext, current.Filter);

if (_exceptionContext.Exception == null)
if (_exceptionContext.ExceptionHandled)
{
_logger.ExceptionFilterShortCircuited(current.Filter);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public async Task InvokeAction_InvokesExceptionFilter_ShortCircuit()
.Callback<ExceptionContext>(context =>
{
filter2.ToString();
context.Exception = null;
context.ExceptionHandled = true;
})
.Verifiable();

Expand All @@ -182,7 +182,7 @@ public async Task InvokeAction_InvokesAsyncExceptionFilter_ShortCircuit()
.Callback<ExceptionContext>(context =>
{
filter2.ToString();
context.Exception = null;
context.ExceptionHandled = true;
})
.Returns<ExceptionContext>((context) => Task.FromResult(true))
.Verifiable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ShortCircuitExceptionFilter : ExceptionFilterAttribute
{
public override void OnException(ExceptionContext context)
{
context.Exception = null;
context.ExceptionHandled = true;
}
}
}

0 comments on commit d57f2d0

Please sign in to comment.