aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs
diff options
context:
space:
mode:
authorsoftworkz <softworkz@hotmail.com>2016-08-18 22:05:54 +0200
committersoftworkz <softworkz@hotmail.com>2016-08-18 22:05:54 +0200
commit66a80ac6b9fee945631e2f1a0a4b6871b7465950 (patch)
treef0c4aea0e51078baa42519438478454d0ceb6dd4 /MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs
parent325a3cc844e338dfac2dd136aa49c05ad9517388 (diff)
EpisodeFileOrganizer: Improve error handling (alternate approach)
Previously some methods were just returning null or empty values in case of encountered errors; as a consequence, the actual reason for failure was never written to the auto-organize log. Instead, only a generic message like "Unable to sort xxx because target path could not be determined." was displayed. After this change, the actual reason for failure will be saved to the auto-organize log or displayed in the UI (when completing the organize dialog). This information is very important for the user. Examples are "No permission", "Target folder not available", "Disk full", etc..
Diffstat (limited to 'MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs')
-rw-r--r--MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs14
1 files changed, 12 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs b/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs
index 60d515e12..9e16613e6 100644
--- a/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs
+++ b/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs
@@ -112,8 +112,13 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
var organizer = new EpisodeFileOrganizer(this, _config, _fileSystem, _logger, _libraryManager,
_libraryMonitor, _providerManager);
- await organizer.OrganizeEpisodeFile(result.OriginalPath, GetAutoOrganizeOptions(), true, CancellationToken.None)
+ var organizeResult = await organizer.OrganizeEpisodeFile(result.OriginalPath, GetAutoOrganizeOptions(), true, CancellationToken.None)
.ConfigureAwait(false);
+
+ if (organizeResult.Status != FileSortingStatus.Success)
+ {
+ throw new Exception(result.StatusMessage);
+ }
}
public Task ClearLog()
@@ -126,7 +131,12 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
var organizer = new EpisodeFileOrganizer(this, _config, _fileSystem, _logger, _libraryManager,
_libraryMonitor, _providerManager);
- await organizer.OrganizeWithCorrection(request, GetAutoOrganizeOptions(), CancellationToken.None).ConfigureAwait(false);
+ var result = await organizer.OrganizeWithCorrection(request, GetAutoOrganizeOptions(), CancellationToken.None).ConfigureAwait(false);
+
+ if (result.Status != FileSortingStatus.Success)
+ {
+ throw new Exception(result.StatusMessage);
+ }
}
public QueryResult<SmartMatchInfo> GetSmartMatchInfos(FileOrganizationResultQuery query)