| 1234567891011121314151617181920212223 |
- namespace Quadarax.Foundation.Core.Exceptions
- {
- public partial class ApiException : System.Exception
- {
- public int StatusCode { get; }
- public string? Response { get; }
- public System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> Headers { get; private set; }
- public ApiException(string message, int statusCode, string? response, System.Collections.Generic.IReadOnlyDictionary<string, System.Collections.Generic.IEnumerable<string>> 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()}";
- }
- }}
|