mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-01-01 02:26:01 +01:00
Use error message from Redacted response
This commit is contained in:
@@ -8,6 +8,7 @@ using FluentValidation;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Indexers.Definitions.Gazelle;
|
||||
@@ -252,7 +253,9 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
|
||||
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))
|
||||
@@ -487,4 +490,9 @@ namespace NzbDrone.Core.Indexers.Definitions
|
||||
[FieldOption(Label = "Required", Hint = "Abort download if unable to use token")]
|
||||
Required = 2,
|
||||
}
|
||||
|
||||
public class RedactedErrorResponse
|
||||
{
|
||||
public string Error { get; init; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user