Class SmsRateLimitException

All Implemented Interfaces:
Serializable

public class SmsRateLimitException extends SmsException
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 Details

    • SmsRateLimitException

      public SmsRateLimitException(String phone, Duration retryAfter)
      Create rate limit exception 创建频率限制异常
      Parameters:
      phone - the phone number | 手机号
      retryAfter - the time to retry after | 重试等待时间
  • Method Details

    • getPhone

      public String getPhone()
      Get phone number 获取手机号
      Returns:
      the phone number | 手机号
    • getMaskedPhone

      public String getMaskedPhone()
      Get masked phone number 获取脱敏后的手机号
      Returns:
      the masked phone | 脱敏后的手机号
    • getRetryAfter

      public Duration getRetryAfter()
      Get retry after duration 获取重试等待时间
      Returns:
      the duration | 时长
    • getRetryAfterSeconds

      public long getRetryAfterSeconds()
      Get retry after in seconds 获取重试等待秒数
      Returns:
      the seconds | 秒数