Use error message from Nebulance response

Fixes #2212
pull/2215/head
Bogdan 4 months ago
parent ab043e87dc
commit 39befe5aa4

@ -244,7 +244,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 '{0}' code from indexer request", indexerResponse.HttpResponse.StatusCode); STJson.TryDeserialize<JsonRpcResponse<NebulanceErrorResponse>>(indexerResponse.HttpResponse.Content, out var errorResponse);
throw new IndexerException(indexerResponse, "Unexpected response status '{0}' code from indexer request: {1}", indexerResponse.HttpResponse.StatusCode, errorResponse?.Result?.Error?.Message ?? "Check the logs for more information.");
} }
JsonRpcResponse<NebulanceResponse> jsonResponse; JsonRpcResponse<NebulanceResponse> jsonResponse;
@ -410,4 +412,14 @@ namespace NzbDrone.Core.Indexers.Definitions
public IEnumerable<string> Tags { get; set; } = Array.Empty<string>(); public IEnumerable<string> Tags { get; set; } = Array.Empty<string>();
} }
public class NebulanceErrorResponse
{
public NebulanceErrorMessage Error { get; set; }
}
public class NebulanceErrorMessage
{
public string Message { get; set; }
}
} }

Loading…
Cancel
Save