namespace Quadarax.Foundation.Core.Exceptions { public partial class ApiException : System.Exception { public int StatusCode { get; } public string? Response { get; } public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } public ApiException(string message, int statusCode, string? response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) { StatusCode = statusCode; Response = response; Headers = headers; } public override string ToString() { return $"HTTP Response: \n\n{Response}\n\n{base.ToString()}"; } }}