using System.Net; namespace Store.Management.Api.Transport; public enum ApiErrorKind { Network, Timeout, Http, Business, InvalidResponse, Unauthorized } public sealed class ApiException : Exception { public ApiErrorKind Kind { get; } public HttpStatusCode? StatusCode { get; } public int? Code { get; } public string? TraceId { get; } public ApiException(ApiErrorKind kind, string message, HttpStatusCode? statusCode = null, int? code = null, string? traceId = null, Exception? innerException = null) : base(message, innerException) => (Kind, StatusCode, Code, TraceId) = (kind, statusCode, code, traceId); }