Skip to content

Commit

Permalink
Use is pattern matching with variable (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kahbazi authored Apr 20, 2020
1 parent fe68996 commit be96d64
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/ReverseProxy.Utilities/Extensions/ExceptionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static bool IsFatal(this Exception exception)
{
exception = exception.InnerException;
}
else if (exception is AggregateException)
else if (exception is AggregateException aex)
{
// AggregateException can contain other AggregateExceptions in its InnerExceptions list so we
// flatten it first. That will essentially create a list of exceptions from the AggregateException's
Expand All @@ -69,7 +69,6 @@ public static bool IsFatal(this Exception exception)
// On that note that's another reason why we want to flatten here as opposed to just let recursion do its magic
// since in an unlikely case there is a circle we'll get OutOfMemory here instead of StackOverflow which is
// a lesser of the two evils.
var aex = exception as AggregateException; // Can't be null
var faex = aex.Flatten();
var iexs = faex.InnerExceptions;
if (iexs != null)
Expand Down

0 comments on commit be96d64

Please sign in to comment.