From 9aea46f82375d0314772fe5e58642b81bbdb6ccf Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 3 Dec 2015 11:45:14 -0500 Subject: [PATCH] add error handling --- MediaBrowser.Api/ApiEntryPoint.cs | 18 ++++++++---------- MediaBrowser.Api/Library/LibraryHelpers.cs | 5 +++++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index 7f4db5a89f..1abbce4084 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -709,7 +709,10 @@ namespace MediaBrowser.Api public void StartKillTimer(TimerCallback callback, int intervalMs) { - CheckHasExited(); + if (HasExited) + { + return; + } lock (_timerLock) { @@ -728,7 +731,10 @@ namespace MediaBrowser.Api public void ChangeKillTimerIfStarted() { - CheckHasExited(); + if (HasExited) + { + return; + } lock (_timerLock) { @@ -741,14 +747,6 @@ namespace MediaBrowser.Api } } } - - private void CheckHasExited() - { - if (HasExited) - { - throw new ObjectDisposedException("Job"); - } - } } /// diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs index 111922bcad..2e0afa4116 100644 --- a/MediaBrowser.Api/Library/LibraryHelpers.cs +++ b/MediaBrowser.Api/Library/LibraryHelpers.cs @@ -56,6 +56,11 @@ namespace MediaBrowser.Api.Library /// The app paths. public static void AddMediaPath(IFileSystem fileSystem, string virtualFolderName, string path, IServerApplicationPaths appPaths) { + if (!string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentNullException("path"); + } + if (!fileSystem.DirectoryExists(path)) { throw new DirectoryNotFoundException("The path does not exist.");