diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs index 9d88a75e7..5362fc4e0 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs @@ -8,6 +8,7 @@ using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; +using NzbDrone.Core.Exceptions; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Validation; using NzbDrone.Core.RemotePathMappings; @@ -40,12 +41,12 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd var response = _proxy.DownloadNzb(fileContent, filename, category, priority, Settings); - if (response != null && response.Ids.Any()) + if (response == null || response.Ids.Empty()) { - return response.Ids.First(); + throw new DownloadClientRejectedReleaseException(remoteEpisode.Release, "SABnzbd rejected the NZB for an unknown reason"); } - return null; + return response.Ids.First(); } private IEnumerable GetQueue() diff --git a/src/NzbDrone.Core/Exceptions/DownloadClientRejectedReleaseException.cs b/src/NzbDrone.Core/Exceptions/DownloadClientRejectedReleaseException.cs new file mode 100644 index 000000000..e7cee87d8 --- /dev/null +++ b/src/NzbDrone.Core/Exceptions/DownloadClientRejectedReleaseException.cs @@ -0,0 +1,28 @@ +using System; +using NzbDrone.Core.Parser.Model; + +namespace NzbDrone.Core.Exceptions +{ + public class DownloadClientRejectedReleaseException : ReleaseDownloadException + { + public DownloadClientRejectedReleaseException(ReleaseInfo release, string message, params object[] args) + : base(release, message, args) + { + } + + public DownloadClientRejectedReleaseException(ReleaseInfo release, string message) + : base(release, message) + { + } + + public DownloadClientRejectedReleaseException(ReleaseInfo release, string message, Exception innerException, params object[] args) + : base(release, message, innerException, args) + { + } + + public DownloadClientRejectedReleaseException(ReleaseInfo release, string message, Exception innerException) + : base(release, message, innerException) + { + } + } +} diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 312397fa0..6a03f4386 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -147,6 +147,7 @@ +