Display downtime message for Nebulance

pull/2150/head
Bogdan 7 months ago
parent 1a428197b2
commit 0ef42dbb4d

@ -228,10 +228,21 @@ 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");
throw new IndexerException(indexerResponse, "Unexpected response status '{0}' code from indexer request", indexerResponse.HttpResponse.StatusCode);
}
var jsonResponse = STJson.Deserialize<JsonRpcResponse<NebulanceTorrents>>(indexerResponse.HttpResponse.Content);
JsonRpcResponse<NebulanceTorrents> jsonResponse;
try
{
jsonResponse = STJson.Deserialize<JsonRpcResponse<NebulanceTorrents>>(indexerResponse.HttpResponse.Content);
}
catch (Exception ex)
{
STJson.TryDeserialize<JsonRpcResponse<string>>(indexerResponse.HttpResponse.Content, out var response);
throw new IndexerException(indexerResponse, "Unexpected response from indexer request: {0}", ex, response?.Result ?? ex.Message);
}
if (jsonResponse.Error != null || jsonResponse.Result == null)
{

@ -1,23 +1,34 @@
using NzbDrone.Common.Exceptions;
using System;
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.Indexers.Exceptions
{
public class IndexerException : NzbDroneException
{
private readonly IndexerResponse _indexerResponse;
public IndexerResponse Response { get; }
public IndexerException(IndexerResponse response, string message)
: base(message)
{
Response = response;
}
public IndexerException(IndexerResponse response, string message, Exception innerException)
: base(message, innerException)
{
Response = response;
}
public IndexerException(IndexerResponse response, string message, params object[] args)
: base(message, args)
{
_indexerResponse = response;
Response = response;
}
public IndexerException(IndexerResponse response, string message)
: base(message)
public IndexerException(IndexerResponse response, string message, Exception innerException, params object[] args)
: base(message, innerException, args)
{
_indexerResponse = response;
Response = response;
}
public IndexerResponse Response => _indexerResponse;
}
}

Loading…
Cancel
Save