mirror of https://github.com/lidarr/Lidarr
Better logging when adding a new indexer and it fails
This commit is contained in:
parent
ce31732b95
commit
e0d8d18838
|
@ -1,6 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Api.Mapping;
|
||||
|
|
|
@ -21,8 +21,6 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
|||
return new HealthCheck(HealthCheckResultType.Error, "No indexers are enabled");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (enabled.All(i => i.SupportsSearching == false))
|
||||
{
|
||||
return new HealthCheck(HealthCheckResultType.Warning, "Enabled indexers do not support searching");
|
||||
|
|
|
@ -17,7 +17,12 @@ namespace NzbDrone.Core.Indexers
|
|||
private readonly IIndexerRepository _providerRepository;
|
||||
private readonly INewznabTestService _newznabTestService;
|
||||
|
||||
public IndexerFactory(IIndexerRepository providerRepository, IEnumerable<IIndexer> providers, IContainer container, IEventAggregator eventAggregator, INewznabTestService newznabTestService, Logger logger)
|
||||
public IndexerFactory(IIndexerRepository providerRepository,
|
||||
IEnumerable<IIndexer> providers,
|
||||
IContainer container,
|
||||
IEventAggregator eventAggregator,
|
||||
INewznabTestService newznabTestService,
|
||||
Logger logger)
|
||||
: base(providerRepository, providers, container, eventAggregator, logger)
|
||||
{
|
||||
_providerRepository = providerRepository;
|
||||
|
|
|
@ -17,12 +17,11 @@ namespace NzbDrone.Core.Indexers.Newznab
|
|||
var code = Convert.ToInt32(error.Attribute("code").Value);
|
||||
var errorMessage = error.Attribute("description").Value;
|
||||
|
||||
|
||||
if (code >= 100 && code <= 199) throw new ApiKeyException("Invalid API key");
|
||||
|
||||
if (!url.Contains("apikey=") && errorMessage == "Missing parameter")
|
||||
{
|
||||
throw new ApiKeyException("Indexer requires and API key");
|
||||
throw new ApiKeyException("Indexer requires an API key");
|
||||
}
|
||||
|
||||
throw new NewznabException("Newznab error detected: {0}", errorMessage);
|
||||
|
|
|
@ -48,11 +48,11 @@ namespace NzbDrone.Core.Indexers
|
|||
var apiKeyFailure = new ValidationFailure("ApiKey", "Invalid API Key");
|
||||
throw new ValidationException(new List<ValidationFailure> { apiKeyFailure }.ToArray());
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn("Indexer doesn't appear to be Newznab based");
|
||||
_logger.WarnException("Indexer doesn't appear to be Newznab based: " + ex.Message, ex);
|
||||
|
||||
var failure = new ValidationFailure("Url", "Invalid Newznab URL entered");
|
||||
var failure = new ValidationFailure("Url", "Invalid Newznab URL, check log for details");
|
||||
throw new ValidationException(new List<ValidationFailure> { failure }.ToArray());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue