Skip to content

Commit 4295b50

Browse files
authored
Code cleanup in IsFatal exception method (#10541)
1 parent 5bac761 commit 4295b50

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/WebJobs.Script/Extensions/ExceptionExtensions.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,16 @@ public static bool IsFatal(this Exception exception)
1414
{
1515
while (exception != null)
1616
{
17-
if ((exception is OutOfMemoryException && !(exception is InsufficientMemoryException)) ||
18-
exception is ThreadAbortException ||
19-
exception is AccessViolationException ||
20-
exception is SEHException ||
21-
exception is StackOverflowException)
17+
if (exception
18+
is (OutOfMemoryException and not InsufficientMemoryException)
19+
or ThreadAbortException
20+
or AccessViolationException
21+
or SEHException
22+
or StackOverflowException)
2223
{
2324
return true;
2425
}
2526

26-
if (exception is TypeInitializationException &&
27-
exception is TargetInvocationException)
28-
{
29-
break;
30-
}
31-
3227
exception = exception.InnerException;
3328
}
3429

0 commit comments

Comments
 (0)