mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Catch JsonReaderException when parsing JSON in Cardigann
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Net;
|
||||
using AngleSharp.Dom;
|
||||
using AngleSharp.Html.Parser;
|
||||
using AngleSharp.Xml.Parser;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
@@ -64,7 +65,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
|
||||
|
||||
var searchUrlUri = new Uri(request.Url.FullUri);
|
||||
|
||||
if (request.SearchPath.Response != null && request.SearchPath.Response.Type.Equals("json"))
|
||||
if (request.SearchPath.Response is { Type: "json" })
|
||||
{
|
||||
if (request.SearchPath.Response != null &&
|
||||
request.SearchPath.Response.NoResultsMessage != null &&
|
||||
@@ -73,7 +74,18 @@ namespace NzbDrone.Core.Indexers.Definitions.Cardigann
|
||||
return releases;
|
||||
}
|
||||
|
||||
var parsedJson = JToken.Parse(results);
|
||||
JToken parsedJson;
|
||||
|
||||
try
|
||||
{
|
||||
parsedJson = JToken.Parse(results);
|
||||
}
|
||||
catch (JsonReaderException ex)
|
||||
{
|
||||
_logger.Error(ex, "Unable to parse JSON response from indexer");
|
||||
|
||||
throw new IndexerException(indexerResponse, "Error Parsing Json Response");
|
||||
}
|
||||
|
||||
if (parsedJson == null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user