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

This commit is contained in:
Mark McDowall 2019-04-29 18:18:06 -07:00
parent 052ddc11b7
commit 1b3acb52f1
3 changed files with 33 additions and 3 deletions

View File

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

View File

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

View File

@ -147,6 +147,7 @@
<Compile Include="Datastore\Migration\126_add_custom_filters.cs" />
<Compile Include="DecisionEngine\Specifications\MultiSeasonSpecification.cs" />
<Compile Include="DecisionEngine\Specifications\UpgradeAllowedSpecification.cs" />
<Compile Include="Exceptions\DownloadClientRejectedReleaseException.cs" />
<Compile Include="Exceptions\SearchFailedException.cs" />
<Compile Include="Extras\Metadata\MetadataSectionType.cs" />
<Compile Include="Download\Aggregation\RemoteEpisodeAggregationService.cs" />