mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-18 17:47:54 +08:00
#18449: Failing sage when an exception occurs in a notification provider
Work Item: 18449 --HG-- branch : 1.x
This commit is contained in:
@@ -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<INotificationProvider> notificationProviders) {
|
||||
_notificationProviders = notificationProviders;
|
||||
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public IEnumerable<NotifyEntry> 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<NotifyEntry>();
|
||||
}
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user