1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Fixed: Do not prevent adding of indexer when API request limit was reached

This commit is contained in:
Mark McDowall 2014-03-21 07:59:42 -07:00
parent 0cad77303d
commit 357726ed09
4 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,17 @@
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.Indexers.Exceptions
{
public class RequestLimitReachedException : NzbDroneException
{
public RequestLimitReachedException(string message, params object[] args)
: base(message, args)
{
}
public RequestLimitReachedException(string message)
: base(message)
{
}
}
}

View File

@ -24,6 +24,11 @@ public static void Process(string source, string url)
throw new ApiKeyException("Indexer requires an API key"); throw new ApiKeyException("Indexer requires an API key");
} }
if (errorMessage == "Request limit reached")
{
throw new RequestLimitReachedException("API limit reached");
}
throw new NewznabException("Newznab error detected: {0}", errorMessage); throw new NewznabException("Newznab error detected: {0}", errorMessage);
} }
} }

View File

@ -46,7 +46,11 @@ public void Test(IIndexer indexer)
_logger.Warn("Indexer returned result for Newznab RSS URL, API Key appears to be invalid"); _logger.Warn("Indexer returned result for Newznab RSS URL, API Key appears to be invalid");
var apiKeyFailure = new ValidationFailure("ApiKey", "Invalid API Key"); var apiKeyFailure = new ValidationFailure("ApiKey", "Invalid API Key");
throw new ValidationException(new List<ValidationFailure> { apiKeyFailure }.ToArray()); throw new ValidationException(new List<ValidationFailure> {apiKeyFailure}.ToArray());
}
catch (RequestLimitReachedException)
{
_logger.Warn("Request limit reached");
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -299,6 +299,7 @@
<Compile Include="Indexers\BasicTorrentRssParser.cs" /> <Compile Include="Indexers\BasicTorrentRssParser.cs" />
<Compile Include="Indexers\DownloadProtocols.cs" /> <Compile Include="Indexers\DownloadProtocols.cs" />
<Compile Include="Indexers\Exceptions\ApiKeyException.cs" /> <Compile Include="Indexers\Exceptions\ApiKeyException.cs" />
<Compile Include="Indexers\Exceptions\RequestLimitReachedException.cs" />
<Compile Include="Indexers\Eztv\Eztv.cs" /> <Compile Include="Indexers\Eztv\Eztv.cs" />
<Compile Include="Indexers\FetchAndParseRssService.cs" /> <Compile Include="Indexers\FetchAndParseRssService.cs" />
<Compile Include="Indexers\IIndexer.cs" /> <Compile Include="Indexers\IIndexer.cs" />