Reorder exception logging to reduce duplication
This commit is contained in:
@@ -191,20 +191,28 @@ quit";
|
|||||||
|
|
||||||
private void LogException(Exception ex)
|
private void LogException(Exception ex)
|
||||||
{
|
{
|
||||||
if (ex.InnerException != null)
|
if (ex is AggregateException ag)
|
||||||
{
|
{
|
||||||
LogException(ex.InnerException);
|
foreach (var e in ag.InnerExceptions)
|
||||||
|
LogException(e);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Fatal(ex);
|
Log.Fatal(ex);
|
||||||
|
|
||||||
if (ex is ReflectionTypeLoadException exti)
|
if (ex is ReflectionTypeLoadException extl)
|
||||||
foreach (Exception exl in exti.LoaderExceptions)
|
{
|
||||||
|
foreach (var exl in extl.LoaderExceptions)
|
||||||
LogException(exl);
|
LogException(exl);
|
||||||
|
|
||||||
if (ex is AggregateException ag)
|
return;
|
||||||
foreach (Exception e in ag.InnerExceptions)
|
}
|
||||||
LogException(e);
|
|
||||||
|
if (ex.InnerException != null)
|
||||||
|
{
|
||||||
|
LogException(ex.InnerException);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleException(object sender, UnhandledExceptionEventArgs e)
|
private void HandleException(object sender, UnhandledExceptionEventArgs e)
|
||||||
|
Reference in New Issue
Block a user