diff --git a/src/Orchard/UI/Admin/Notification/NotificationManager.cs b/src/Orchard/UI/Admin/Notification/NotificationManager.cs index bb15ac9c8..327b4f1c1 100644 --- a/src/Orchard/UI/Admin/Notification/NotificationManager.cs +++ b/src/Orchard/UI/Admin/Notification/NotificationManager.cs @@ -1,5 +1,7 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; +using Orchard.Logging; using Orchard.UI.Notify; namespace Orchard.UI.Admin.Notification { @@ -8,11 +10,23 @@ namespace Orchard.UI.Admin.Notification { public NotificationManager(IEnumerable notificationProviders) { _notificationProviders = notificationProviders; + + Logger = NullLogger.Instance; } + public ILogger Logger { get; set; } + public IEnumerable GetNotifications() { return _notificationProviders - .SelectMany(n => n.GetNotifications()); + .SelectMany(n => { + try { + return n.GetNotifications(); + } + catch(Exception e) { + Logger.Error("An unhandled exception was thrown while generating a notification: " + n.GetType(), e); + return Enumerable.Empty(); + } + }).ToList(); } } }