mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-12-29 17:15:34 +01:00
Added ContentSummary to be able to describe the ContentData in a human readable form. (Useful for JsonRpc and FormData).
33 lines
913 B
C#
33 lines
913 B
C#
using System;
|
|
|
|
namespace NzbDrone.Common.Http
|
|
{
|
|
public class HttpException : Exception
|
|
{
|
|
public HttpRequest Request { get; private set; }
|
|
public HttpResponse Response { get; private set; }
|
|
|
|
public HttpException(HttpRequest request, HttpResponse response)
|
|
: base(string.Format("HTTP request failed: [{0}:{1}] [{2}] at [{3}]", (int)response.StatusCode, response.StatusCode, request.Method, request.Url.AbsoluteUri))
|
|
{
|
|
Request = request;
|
|
Response = response;
|
|
}
|
|
|
|
public HttpException(HttpResponse response)
|
|
: this(response.Request, response)
|
|
{
|
|
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
if (Response != null)
|
|
{
|
|
return base.ToString() + Environment.NewLine + Response.Content;
|
|
}
|
|
|
|
return base.ToString();
|
|
}
|
|
}
|
|
} |