Use error message from Redacted response

pull/2309/head
Bogdan 6 days ago
parent 7cba7152f1
commit 6bdf5f5d69

@ -8,6 +8,7 @@ using FluentValidation;
using NLog; using NLog;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Common.Serializer;
using NzbDrone.Core.Annotations; using NzbDrone.Core.Annotations;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Definitions.Gazelle; using NzbDrone.Core.Indexers.Definitions.Gazelle;
@ -252,7 +253,9 @@ namespace NzbDrone.Core.Indexers.Definitions
if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK) if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)
{ {
throw new IndexerException(indexerResponse, $"Unexpected response status {indexerResponse.HttpResponse.StatusCode} code from indexer request"); STJson.TryDeserialize<RedactedErrorResponse>(indexerResponse.Content, out var errorResponse);
throw new IndexerException(indexerResponse, $"Unexpected response status {indexerResponse.HttpResponse.StatusCode} code from indexer request: {errorResponse?.Error ?? "Check the logs for more information."}");
} }
if (!indexerResponse.HttpResponse.Headers.ContentType.Contains(HttpAccept.Json.Value)) if (!indexerResponse.HttpResponse.Headers.ContentType.Contains(HttpAccept.Json.Value))
@ -487,4 +490,9 @@ namespace NzbDrone.Core.Indexers.Definitions
[FieldOption(Label = "Required", Hint = "Abort download if unable to use token")] [FieldOption(Label = "Required", Hint = "Abort download if unable to use token")]
Required = 2, Required = 2,
} }
public class RedactedErrorResponse
{
public string Error { get; init; }
}
} }

Loading…
Cancel
Save