Fixed: Log download client name when communication fails
This commit is contained in:
parent
f0933b9786
commit
2d42c59d70
|
@ -3,7 +3,9 @@ using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.HealthCheck.Checks;
|
using NzbDrone.Core.HealthCheck.Checks;
|
||||||
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Core.ThingiProvider;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
|
@ -25,6 +27,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
public void should_return_error_when_download_client_throws()
|
public void should_return_error_when_download_client_throws()
|
||||||
{
|
{
|
||||||
var downloadClient = Mocker.GetMock<IDownloadClient>();
|
var downloadClient = Mocker.GetMock<IDownloadClient>();
|
||||||
|
downloadClient.Setup(s => s.Definition).Returns(new IndexerDefinition{Name = "Test"});
|
||||||
|
|
||||||
downloadClient.Setup(s => s.GetItems())
|
downloadClient.Setup(s => s.GetItems())
|
||||||
.Throws<Exception>();
|
.Throws<Exception>();
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.ThingiProvider;
|
using NzbDrone.Core.ThingiProvider;
|
||||||
|
|
|
@ -25,17 +25,19 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No download client is available");
|
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No download client is available");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
foreach (var downloadClient in downloadClients)
|
||||||
{
|
{
|
||||||
foreach (var downloadClient in downloadClients)
|
try
|
||||||
{
|
{
|
||||||
downloadClient.GetItems();
|
downloadClient.GetItems();
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
catch (Exception ex)
|
{
|
||||||
{
|
var message = String.Format("Unable to communicate with {0}.", downloadClient.Definition.Name);
|
||||||
_logger.Error("Unable to communicate with download client: ", ex);
|
|
||||||
return new HealthCheck(GetType(), HealthCheckResult.Error, "Unable to communicate with download client: " + ex.Message);
|
_logger.Error(message, ex);
|
||||||
|
return new HealthCheck(GetType(), HealthCheckResult.Error, message + " " + ex.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HealthCheck(GetType());
|
return new HealthCheck(GetType());
|
||||||
|
|
Loading…
Reference in New Issue