namespace FozFc.Api.Application.Common; /// /// Thrown by application services to signal an HTTP error with a status code and /// user-facing message. Translated to a JSON error response at the API boundary. /// public sealed class ApiException : Exception { public int StatusCode { get; } public ApiException(int statusCode, string message) : base(message) => StatusCode = statusCode; public static ApiException BadRequest(string message) => new(400, message); public static ApiException Unauthorized(string message) => new(401, message); public static ApiException Forbidden(string message) => new(403, message); public static ApiException NotFound(string message) => new(404, message); public static ApiException Conflict(string message) => new(409, message); }