mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-01 16:06:24 +02:00
Display downtime message for Nebulance
This commit is contained in:
@@ -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 IndexerException(IndexerResponse response, string message, params object[] args)
|
||||
: base(message, args)
|
||||
{
|
||||
_indexerResponse = response;
|
||||
}
|
||||
public IndexerResponse Response { get; }
|
||||
|
||||
public IndexerException(IndexerResponse response, string message)
|
||||
: base(message)
|
||||
{
|
||||
_indexerResponse = response;
|
||||
Response = response;
|
||||
}
|
||||
|
||||
public IndexerResponse Response => _indexerResponse;
|
||||
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)
|
||||
{
|
||||
Response = response;
|
||||
}
|
||||
|
||||
public IndexerException(IndexerResponse response, string message, Exception innerException, params object[] args)
|
||||
: base(message, innerException, args)
|
||||
{
|
||||
Response = response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user