From b5d9cb9fab64bc1d8153301e04424e9767a7b122 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 3 May 2013 13:26:44 -0400 Subject: [PATCH] add try/catch for library manager events --- .../Library/LibraryManager.cs | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 90b7850fb..25c0c9842 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -1059,7 +1059,14 @@ namespace MediaBrowser.Server.Implementations.Library if (ItemAdded != null) { - ItemAdded(this, new ItemChangeEventArgs { Item = item }); + try + { + ItemAdded(this, new ItemChangeEventArgs { Item = item }); + } + catch (Exception ex) + { + _logger.ErrorException("Error in ItemUpdated event handler", ex); + } } } @@ -1077,7 +1084,14 @@ namespace MediaBrowser.Server.Implementations.Library if (ItemUpdated != null) { - ItemUpdated(this, new ItemChangeEventArgs { Item = item }); + try + { + ItemUpdated(this, new ItemChangeEventArgs { Item = item }); + } + catch (Exception ex) + { + _logger.ErrorException("Error in ItemUpdated event handler", ex); + } } } @@ -1089,7 +1103,14 @@ namespace MediaBrowser.Server.Implementations.Library { if (ItemRemoved != null) { - ItemRemoved(this, new ItemChangeEventArgs { Item = item }); + try + { + ItemRemoved(this, new ItemChangeEventArgs { Item = item }); + } + catch (Exception ex) + { + _logger.ErrorException("Error in ItemRemoved event handler", ex); + } } }