mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-13 20:47:24 +00:00
Logging individual exceptions from an aggregate
This commit is contained in:
parent
05bc50d2a0
commit
ba0ce760a5
1 changed files with 12 additions and 0 deletions
|
|
@ -92,6 +92,18 @@ namespace ICD.Common.Services.Logging
|
||||||
if (e == null)
|
if (e == null)
|
||||||
throw new ArgumentNullException("e");
|
throw new ArgumentNullException("e");
|
||||||
|
|
||||||
|
#if STANDARD
|
||||||
|
if (e is AggregateException)
|
||||||
|
{
|
||||||
|
AggregateException aggregate = e as AggregateException;
|
||||||
|
// We want the stack trace from the aggregate exception but the type and message from the inner.
|
||||||
|
foreach (Exception inner in aggregate.InnerExceptions)
|
||||||
|
extends.AddEntry(severity, string.Format("{0}: {1}{2}{3}{2}{4}", inner.GetType().Name, message,
|
||||||
|
IcdEnvironment.NewLine, inner.Message, e.StackTrace));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
extends.AddEntry(severity, string.Format("{0}: {1}{2}{3}{2}{4}", e.GetType().Name, message,
|
extends.AddEntry(severity, string.Format("{0}: {1}{2}{3}{2}{4}", e.GetType().Name, message,
|
||||||
IcdEnvironment.NewLine, e.Message, e.StackTrace));
|
IcdEnvironment.NewLine, e.Message, e.StackTrace));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue