1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-19 17:32:38 +01:00

Improve messaging on indexer specified download client is not available

(cherry picked from commit 84e657482d37eed35f09c6dab3c2b8b5ebd5bac4)
This commit is contained in:
Bogdan 2024-02-07 09:46:10 +02:00
parent 4676ecfce9
commit 6c459c744a

View File

@ -59,13 +59,18 @@ public IDownloadClient GetDownloadClient(DownloadProtocol downloadProtocol, int
{ {
var indexer = _indexerFactory.Find(indexerId); var indexer = _indexerFactory.Find(indexerId);
if (indexer != null && indexer.DownloadClientId > 0) if (indexer is { DownloadClientId: > 0 })
{ {
var client = availableProviders.SingleOrDefault(d => d.Definition.Id == indexer.DownloadClientId); var client = availableProviders.SingleOrDefault(d => d.Definition.Id == indexer.DownloadClientId);
if (client == null || (filterBlockedClients && blockedProviders.Contains(client.Definition.Id))) if (client == null)
{ {
throw new DownloadClientUnavailableException($"Indexer specified download client is not available"); throw new DownloadClientUnavailableException($"Indexer specified download client does not exist for {indexer.Name}");
}
if (filterBlockedClients && blockedProviders.Contains(client.Definition.Id))
{
throw new DownloadClientUnavailableException($"Indexer specified download client is not available due to recent failures for {indexer.Name}");
} }
return client; return client;