wabbajack/Wabbajack.Lib/Exceptions/HttpException.cs

25 lines
637 B
C#
Raw Normal View History

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
namespace Wabbajack.Lib.Exceptions
{
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
}
}