diff --git a/Gw2Sharp/WebApi/Exceptions/RequestException.cs b/Gw2Sharp/WebApi/Exceptions/RequestException.cs index a8b42c6ef..7e994ffc5 100644 --- a/Gw2Sharp/WebApi/Exceptions/RequestException.cs +++ b/Gw2Sharp/WebApi/Exceptions/RequestException.cs @@ -6,7 +6,7 @@ namespace Gw2Sharp.WebApi.Exceptions /// /// A generic request exception used for the web API. /// - public class RequestException : RequestException + public class RequestException : Exception { /// /// Creates a new . @@ -15,7 +15,8 @@ public class RequestException : RequestException /// The message. /// or is . public RequestException(IWebApiRequest request, string message) : - base(request, message) { } + this(request, null, message, null) + { } /// /// Creates a new . @@ -25,7 +26,8 @@ public RequestException(IWebApiRequest request, string message) : /// The message. /// or is . public RequestException(IWebApiRequest request, IWebApiResponse? response, string message) : - base(request, response, message) { } + this(request, response, message, null) + { } /// /// Creates a new . @@ -35,7 +37,8 @@ public RequestException(IWebApiRequest request, IWebApiResponse? respons /// The inner exception. /// or is . public RequestException(IWebApiRequest request, string message, Exception? innerException) : - base(request, message, innerException) { } + this(request, null, message, innerException) + { } /// /// Creates a new . @@ -44,9 +47,22 @@ public RequestException(IWebApiRequest request, string message, Exception? inner /// The response. /// The message. /// The inner exception. - /// or is . - public RequestException(IWebApiRequest request, IWebApiResponse? response, string message, Exception innerException) : - base(request, response, message, innerException) { } + public RequestException(IWebApiRequest request, IWebApiResponse? response, string message, Exception? innerException) : + base(message, innerException) + { + this.Request = request ?? throw new ArgumentNullException(nameof(request)); + this.Response = response; + } + + /// + /// Gets the original request. + /// + public IWebApiRequest Request { get; } + + /// + /// Gets the response. + /// + public IWebApiResponse? Response { get; } } @@ -54,7 +70,7 @@ public RequestException(IWebApiRequest request, IWebApiResponse? respons /// A generic request exception used for the web API. /// /// The response object. - public class RequestException : Exception + public class RequestException : RequestException { /// /// Creates a new . @@ -63,7 +79,8 @@ public class RequestException : Exception /// The message. /// or is . public RequestException(IWebApiRequest request, string message) : - this(request, null, message, null) { } + this(request, null, message, null) + { } /// /// Creates a new . @@ -73,7 +90,8 @@ public RequestException(IWebApiRequest request, string message) : /// The message. /// or is . public RequestException(IWebApiRequest request, IWebApiResponse? response, string message) : - this(request, response, message, null) { } + this(request, response, message, null) + { } /// /// Creates a new . @@ -83,7 +101,8 @@ public RequestException(IWebApiRequest request, IWebApiResponse? resp /// The inner exception. /// or is . public RequestException(IWebApiRequest request, string message, Exception? innerException) : - this(request, null, message, innerException) { } + this(request, null, message, innerException) + { } /// /// Creates a new . @@ -93,20 +112,14 @@ public RequestException(IWebApiRequest request, string message, Exception? inner /// The message. /// The inner exception. public RequestException(IWebApiRequest request, IWebApiResponse? response, string message, Exception? innerException) : - base(message, innerException) + base(request, null, message, innerException) { - this.Request = request ?? throw new ArgumentNullException(nameof(request)); this.Response = response; } - /// - /// Gets the original request. - /// - public IWebApiRequest Request { get; } - /// /// Gets the response. /// - public IWebApiResponse? Response { get; } + public new IWebApiResponse? Response { get; } } }