2020-01-07 13:50:11 +00:00
|
|
|
|
using System;
|
2020-05-20 03:25:41 +00:00
|
|
|
|
using System.Net.Http;
|
2020-01-07 13:50:11 +00:00
|
|
|
|
|
2020-05-21 22:12:51 +00:00
|
|
|
|
namespace Wabbajack.Common.Exceptions
|
2020-01-07 13:50:11 +00:00
|
|
|
|
{
|
|
|
|
|
public class HttpException : Exception
|
|
|
|
|
{
|
|
|
|
|
public string Reason { get; set; }
|
|
|
|
|
public int Code { get; set; }
|
|
|
|
|
|
|
|
|
|
public HttpException(int code, string reason) : base($"Http Error {code} - {reason}")
|
|
|
|
|
{
|
|
|
|
|
Code = code;
|
|
|
|
|
Reason = reason;
|
|
|
|
|
}
|
2020-05-20 03:25:41 +00:00
|
|
|
|
|
|
|
|
|
public HttpException(HttpResponseMessage response) : base(
|
|
|
|
|
$"Http Error {response.StatusCode} - {response.ReasonPhrase}")
|
|
|
|
|
{
|
|
|
|
|
Code = (int)response.StatusCode;
|
|
|
|
|
Reason = response.ReasonPhrase;
|
|
|
|
|
}
|
2020-01-07 13:50:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|