Fixed: Don't treat NZBs rejected by SABnzbd as successful

pull/808/head
Qstick 6 years ago
parent 499ec06664
commit 970d46512e

@ -349,7 +349,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
{
Mocker.GetMock<ISabnzbdProxy>()
.Setup(s => s.DownloadNzb(It.IsAny<byte[]>(), It.IsAny<string>(), It.IsAny<string>(), (int)SabnzbdPriority.High, It.IsAny<SabnzbdSettings>()))
.Returns(new SabnzbdAddResponse());
.Returns(new SabnzbdAddResponse { Ids = new List<string> { "lidarrtest" } });
var remoteAlbum = CreateRemoteAlbum();
remoteAlbum.Albums = Builder<Album>.CreateListOfSize(1)

@ -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<DownloadClientItem> GetQueue()

@ -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)
{
}
}
}

@ -455,6 +455,7 @@
<Compile Include="Exceptions\AlbumNotFoundException.cs" />
<Compile Include="Exceptions\ArtistNotFoundException.cs" />
<Compile Include="Exceptions\BadRequestException.cs" />
<Compile Include="Exceptions\DownloadClientRejectedReleaseException.cs" />
<Compile Include="Exceptions\DownstreamException.cs" />
<Compile Include="Exceptions\NzbDroneClientException.cs" />
<Compile Include="Exceptions\ReleaseUnavailableException.cs" />
@ -1331,4 +1332,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
Loading…
Cancel
Save