mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-30 19:56:54 +00:00
26 lines
No EOL
725 B
C#
26 lines
No EOL
725 B
C#
using System;
|
|
using RestSharp;
|
|
|
|
namespace NzbDrone.Core.Rest
|
|
{
|
|
public class RestException : Exception
|
|
{
|
|
public IRestResponse Response { get; private set; }
|
|
|
|
public RestException(IRestResponse response, IRestClient restClient)
|
|
: base(string.Format("REST request failed: [{0}] [{1}] at [{2}]", (int)response.StatusCode, response.Request.Method, restClient.BuildUri(response.Request)))
|
|
{
|
|
Response = response;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
if (Response != null)
|
|
{
|
|
return base.ToString() + Environment.NewLine + Response.Content;
|
|
}
|
|
|
|
return base.ToString();
|
|
}
|
|
}
|
|
} |