Class SmsRateLimitException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.sms.exception.SmsException
cloud.opencode.base.sms.exception.SmsRateLimitException
- All Implemented Interfaces:
Serializable
SMS Rate Limit Exception
短信频率限制异常
Exception thrown when SMS rate limit is exceeded.
超出短信频率限制时抛出的异常。
Features | 主要功能:
- Phone number and retry-after duration tracking - 手机号和重试等待时间跟踪
- Masked phone number for safe logging - 脱敏手机号用于安全日志
Usage Examples | 使用示例:
throw new SmsRateLimitException("13800138000", Duration.ofMinutes(1));
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Since:
- JDK 25, opencode-base-sms V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSmsRateLimitException(String phone, Duration retryAfter) Create rate limit exception 创建频率限制异常 -
Method Summary
Modifier and TypeMethodDescriptionGet masked phone number 获取脱敏后的手机号getPhone()Get phone number 获取手机号Get retry after duration 获取重试等待时间longGet retry after in seconds 获取重试等待秒数Methods inherited from class SmsException
getCode, getErrorCodeMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
SmsRateLimitException
-
-
Method Details
-
getPhone
-
getMaskedPhone
Get masked phone number 获取脱敏后的手机号- Returns:
- the masked phone | 脱敏后的手机号
-
getRetryAfter
-
getRetryAfterSeconds
public long getRetryAfterSeconds()Get retry after in seconds 获取重试等待秒数- Returns:
- the seconds | 秒数
-