Reorder exception logging to reduce duplication

This commit is contained in:
John Gross
2019-01-25 12:31:34 -08:00
parent 3f803b8107
commit 6b039288d5

View File

@@ -190,21 +190,29 @@ quit";
}
private void LogException(Exception ex)
{
{
if (ex is AggregateException ag)
{
foreach (var e in ag.InnerExceptions)
LogException(e);
return;
}
Log.Fatal(ex);
if (ex is ReflectionTypeLoadException extl)
{
foreach (var exl in extl.LoaderExceptions)
LogException(exl);
return;
}
if (ex.InnerException != null)
{
LogException(ex.InnerException);
}
Log.Fatal(ex);
if (ex is ReflectionTypeLoadException exti)
foreach (Exception exl in exti.LoaderExceptions)
LogException(exl);
if (ex is AggregateException ag)
foreach (Exception e in ag.InnerExceptions)
LogException(e);
}
private void HandleException(object sender, UnhandledExceptionEventArgs e)