namespace EntitlementBLL.Exceptions;
/// Thrown by IEntitlementService.EnsureQuotaAsync when a quota-type feature would be
/// exceeded by the requested delta (Layer 8 of the resolution algorithm).
public class EntitlementQuotaExceededException : Exception
{
public string FeatureCode { get; }
public long CurrentUsage { get; }
public long Quota { get; }
public long Delta { get; }
public EntitlementQuotaExceededException(string featureCode, long currentUsage, long quota, long delta)
: base($"Quota exceeded for feature '{featureCode}': current usage {currentUsage} + delta {delta} > quota {quota}.")
{
FeatureCode = featureCode;
CurrentUsage = currentUsage;
Quota = quota;
Delta = delta;
}
}
/// Thrown when a subscription, plan, feature, or flag referenced by id/code does not exist.
public class EntitlementNotFoundException : Exception
{
public EntitlementNotFoundException(string message) : base(message) { }
}
/// Thrown when a signed bundle fails ECDSA signature verification or has expired.
public class EntitlementBundleVerificationException : Exception
{
public EntitlementBundleVerificationException(string message) : base(message) { }
}
/// Thrown by IClientProvisioningBLL.CreateClientAsync when the requested ClientCode
/// is already in use (Thread 1 ยง2.2, narrowed to MCLIENT/MUSER creation).
public class ClientCodeAlreadyExistsException : Exception
{
public ClientCodeAlreadyExistsException(string clientCode)
: base($"ClientCode '{clientCode}' is already in use.") { }
}