Fixed: (AvistaZ) Improve message for failed logins

pull/1944/head v1.11.0.4128
Bogdan 1 year ago
parent dcfdd49119
commit 7c38ec2baa

@ -7,6 +7,7 @@ using NLog;
using NzbDrone.Common.Http;
using NzbDrone.Common.Serializer;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions.Avistaz
@ -53,6 +54,8 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
protected abstract IndexerCapabilities SetCapabilities();
protected override async Task DoLogin()
{
try
{
Settings.Token = await GetToken();
@ -63,6 +66,14 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
_logger.Debug("Avistaz authentication succeeded.");
}
catch (HttpException ex) when (ex.Response.StatusCode == HttpStatusCode.Unauthorized)
{
_logger.Warn(ex, "Failed to authenticate with Avistaz");
var jsonResponse = STJson.Deserialize<AvistazErrorResponse>(ex.Response.Content);
throw new IndexerAuthException(jsonResponse?.Message ?? "Unauthorized request to indexer");
}
}
protected override bool CheckIfLoginNeeded(HttpResponse httpResponse)
{

Loading…
Cancel
Save