Log exceptions thrown while terminating components

This commit is contained in:
Ronald Barendse
2019-10-09 00:11:46 +02:00
parent 9a36d10d0c
commit 2170a575f2

View File

@@ -39,8 +39,6 @@ namespace Umbraco.Core.Composing
{
using (_logger.DebugDuration<ComponentCollection>($"Terminating. (log components when >{LogThresholdMilliseconds}ms)", "Terminated."))
{
var exceptions = new List<Exception>();
foreach (var component in this.Reverse()) // terminate components in reverse order
{
var componentType = component.GetType();
@@ -53,15 +51,10 @@ namespace Umbraco.Core.Composing
}
catch (Exception ex)
{
exceptions.Add(ex);
_logger.Error(componentType, ex, "Error while terminating component.");
}
}
}
if (exceptions.Count > 0)
{
throw new AggregateException("One or more errors occurred while terminating components.", exceptions);
}
}
}
}