Also add as data to exception so sentry gets it.

This commit is contained in:
Taloth Saldono 2018-06-08 19:58:58 +02:00
parent cb372f284d
commit 2ed5abf4d3
2 changed files with 14 additions and 1 deletions

View File

@ -34,6 +34,18 @@ namespace NzbDrone.Common.Extensions
var contentSample = response.Content.Substring(0, Math.Min(response.Content.Length, 512)); var contentSample = response.Content.Substring(0, Math.Min(response.Content.Length, 512));
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)
{ {
ex.AddData("ContentType", response.Headers.ContentType ?? string.Empty); ex.AddData("ContentType", response.Headers.ContentType ?? string.Empty);

View File

@ -301,8 +301,9 @@ namespace NzbDrone.Core.Indexers
{ {
return parser.ParseResponse(response).ToList(); return parser.ParseResponse(response).ToList();
} }
catch (Exception) catch (Exception ex)
{ {
ex.WithData(response.HttpResponse, 128*1024);
_logger.Trace("Unexpected Response content ({0} bytes): {1}", response.HttpResponse.ResponseData.Length, response.HttpResponse.Content); _logger.Trace("Unexpected Response content ({0} bytes): {1}", response.HttpResponse.ResponseData.Length, response.HttpResponse.Content);
throw; throw;
} }