mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Added: Log indexer response to Trace if an exception occurs
Co-Authored-By: taloth <taloth@users.noreply.github.com>
This commit is contained in:
parent
7db8226099
commit
6cc05fcca3
2 changed files with 24 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -32,7 +32,19 @@ namespace NzbDrone.Common.Extensions
|
||||||
{
|
{
|
||||||
if (response == null || response.Content == null) return ex;
|
if (response == null || response.Content == null) return ex;
|
||||||
|
|
||||||
var contentSample = response.Content.Substring(0, Math.Min(response.Content.Length, 512));
|
var contentSample = response.Content.Substring(0, Math.Min(response.Content.Length, maxSampleLength));
|
||||||
|
|
||||||
|
if (response.Request != null)
|
||||||
|
{
|
||||||
|
ex.AddData("RequestUri", response.Request.Url.ToString());
|
||||||
|
|
||||||
|
if (response.Request.ContentSummary != null)
|
||||||
|
{
|
||||||
|
ex.AddData("RequestSummary", response.Request.ContentSummary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ex.AddData("StatusCode", response.StatusCode.ToString());
|
||||||
|
|
||||||
if (response.Headers != null)
|
if (response.Headers != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -258,8 +258,17 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
var response = FetchIndexerResponse(request);
|
var response = FetchIndexerResponse(request);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
return parser.ParseResponse(response).ToList();
|
return parser.ParseResponse(response).ToList();
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ex.WithData(response.HttpResponse, 128 * 1024);
|
||||||
|
_logger.Trace("Unexpected Response content ({0} bytes): {1}", response.HttpResponse.ResponseData.Length, response.HttpResponse.Content);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual IndexerResponse FetchIndexerResponse(IndexerRequest request)
|
protected virtual IndexerResponse FetchIndexerResponse(IndexerRequest request)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue