Files
2026-10-27 14:35:03 +08:00

19 lines
657 B
C#

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);
}