Class CaptchaRateLimitException

All Implemented Interfaces:
Serializable

public class CaptchaRateLimitException extends CaptchaException
Captcha Rate Limit Exception - Thrown when rate limit is exceeded 验证码速率限制异常 - 当超过速率限制时抛出

Features | 主要功能:

  • Carries client ID and optional retry-after duration - 携带客户端 ID 和可选的重试等待时间
  • Extends CaptchaException - 继承 CaptchaException

Usage Examples | 使用示例:

throw new CaptchaRateLimitException(clientId);
throw new CaptchaRateLimitException(clientId, Duration.ofMinutes(1));

Security | 安全性:

  • Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
  • Null-safe: No (clientId may be null) - 空值安全: 否(clientId 可能为空)
Since:
JDK 25, opencode-base-captcha V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • CaptchaRateLimitException

      public CaptchaRateLimitException(String clientId)
      Constructs a new exception with the client ID. 使用客户端 ID 构造新异常。
      Parameters:
      clientId - the client ID | 客户端 ID
    • CaptchaRateLimitException

      public CaptchaRateLimitException(String clientId, Duration retryAfter)
      Constructs a new exception with client ID and retry duration. 使用客户端 ID 和重试时间构造新异常。
      Parameters:
      clientId - the client ID | 客户端 ID
      retryAfter - the duration to wait before retry | 重试前等待的时间
  • Method Details

    • getClientId

      public String getClientId()
      Gets the client ID. 获取客户端 ID。
      Returns:
      the client ID | 客户端 ID
    • getRetryAfter

      public Duration getRetryAfter()
      Gets the retry after duration. 获取重试等待时间。
      Returns:
      the retry after duration | 重试等待时间