From 39befe5aa4f409cbc4d237bd7a657aaa21fc1af7 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Fri, 6 Sep 2024 10:41:26 +0300 Subject: [PATCH] Use error message from Nebulance response Fixes #2212 --- .../Indexers/Definitions/Nebulance.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs b/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs index 2c3f74e50..9f2333ea1 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs @@ -244,7 +244,9 @@ namespace NzbDrone.Core.Indexers.Definitions if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK) { - throw new IndexerException(indexerResponse, "Unexpected response status '{0}' code from indexer request", indexerResponse.HttpResponse.StatusCode); + STJson.TryDeserialize>(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 jsonResponse; @@ -410,4 +412,14 @@ namespace NzbDrone.Core.Indexers.Definitions public IEnumerable Tags { get; set; } = Array.Empty(); } + + public class NebulanceErrorResponse + { + public NebulanceErrorMessage Error { get; set; } + } + + public class NebulanceErrorMessage + { + public string Message { get; set; } + } }