Class CaptchaException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CaptchaExpiredException, CaptchaGenerationException, CaptchaNotFoundException, CaptchaRateLimitException, CaptchaVerifyException

public class CaptchaException extends OpenException
Captcha Exception - Base exception for CAPTCHA operations 验证码异常 - 验证码操作的基础异常

This is the base exception class for all CAPTCHA-related exceptions. It extends OpenException to integrate with the unified OpenCode exception hierarchy, providing error code and component name support.

这是所有验证码相关异常的基础异常类。 继承 OpenException 以融入 OpenCode 统一异常体系,支持错误码和组件名称。

Features | 主要功能:

  • Base exception for CAPTCHA exception hierarchy - 验证码异常层次的基础异常
  • Extends OpenException with component="Captcha" - 继承 OpenException,组件名="Captcha"
  • Supports message, cause, errorCode, and combined constructors - 支持消息、原因、错误码和组合构造器
  • Formatted getMessage(): [Captcha] (errorCode) message - 格式化消息

Usage Examples | 使用示例:

throw new CaptchaException("CAPTCHA operation failed");
throw new CaptchaException("CAPTCHA operation failed", cause);

// Catchable as OpenException
try { ... } catch (OpenException e) { ... }   // catches all OpenCode exceptions
try { ... } catch (CaptchaException e) { ... } // catches only captcha exceptions

Security | 安全性:

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

    • CaptchaException

      public CaptchaException(String message)
      Constructs a new exception with the specified message. 使用指定消息构造新异常。
      Parameters:
      message - the detail message | 详细消息
    • CaptchaException

      public CaptchaException(String message, Throwable cause)
      Constructs a new exception with the specified message and cause. 使用指定消息和原因构造新异常。
      Parameters:
      message - the detail message | 详细消息
      cause - the cause | 原因
    • CaptchaException

      public CaptchaException(Throwable cause)
      Constructs a new exception with the specified cause. 使用指定原因构造新异常。
      Parameters:
      cause - the cause | 原因
    • CaptchaException

      public CaptchaException(String errorCode, String message)
      Constructs a new exception with message and error code. 使用消息和错误码构造新异常。
      Parameters:
      errorCode - the error code | 错误码
      message - the detail message | 详细消息
    • CaptchaException

      public CaptchaException(String errorCode, String message, Throwable cause)
      Constructs a new exception with message, error code, and cause. 使用消息、错误码和原因构造新异常。
      Parameters:
      errorCode - the error code | 错误码
      message - the detail message | 详细消息
      cause - the cause | 原因