Skip to content

Commit 0f01c7a

Browse files
committed
clean ExceptionLogic
1 parent f748754 commit 0f01c7a

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

Signum.Engine/Basics/ExceptionLogic.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,10 @@ static ExceptionEntity GetEntity(Exception ex)
6262

6363
entity.ExceptionType = ex.GetType().Name;
6464

65-
var agex = ex as AggregateException;
66-
var exl = new List<Exception>();
67-
if (agex != null)
68-
foreach (var ex0 in agex.InnerExceptions)
69-
{
70-
exl.AddRange(ex0.Follow(e => e.InnerException));
71-
}
72-
else
73-
exl.AddRange(ex.Follow(e => e.InnerException));
65+
var exceptions = ex is AggregateException agex ?
66+
agex.InnerExceptions.SelectMany(inner => inner.Follow(e => e.InnerException)).ToList() :
67+
ex.Follow(e => e.InnerException).ToList();
7468

75-
var exceptions = exl.Distinct();
7669
string messages = exceptions.ToString(e => e.Message, "\r\n\r\n");
7770
string stacktraces = exceptions.ToString(e => e.StackTrace, "\r\n\r\n");
7871

0 commit comments

Comments
 (0)