diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs index 1bada7d29..dfe7225e7 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs @@ -349,7 +349,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests { Mocker.GetMock() .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny(), It.IsAny(), (int)SabnzbdPriority.High, It.IsAny())) - .Returns(new SabnzbdAddResponse()); + .Returns(new SabnzbdAddResponse { Ids = new List { "lidarrtest" } }); var remoteAlbum = CreateRemoteAlbum(); remoteAlbum.Albums = Builder.CreateListOfSize(1) diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs index 77f07f558..1183825e5 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,13 @@ 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(remoteAlbum.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..cb9a4c4dc --- /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 5d23d2250..9fbe860ab 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -455,6 +455,7 @@ + @@ -1331,4 +1332,4 @@ --> - + \ No newline at end of file