diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-12-03 11:45:14 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-12-03 11:45:14 -0500 |
| commit | 9aea46f82375d0314772fe5e58642b81bbdb6ccf (patch) | |
| tree | 8b78dfed43fa351559c19d87e19e22fdc329b762 | |
| parent | b9638b484ddc27de3c554ad622f1bdbdc97541de (diff) | |
add error handling
| -rw-r--r-- | MediaBrowser.Api/ApiEntryPoint.cs | 18 | ||||
| -rw-r--r-- | 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 7f4db5a89..1abbce408 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"); - } - } } /// <summary> diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs index 111922bca..2e0afa411 100644 --- a/MediaBrowser.Api/Library/LibraryHelpers.cs +++ b/MediaBrowser.Api/Library/LibraryHelpers.cs @@ -56,6 +56,11 @@ namespace MediaBrowser.Api.Library /// <param name="appPaths">The app paths.</param> 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."); |
