Enum Class EmailErrorCode

java.lang.Object
java.lang.Enum<EmailErrorCode>
cloud.opencode.base.email.exception.EmailErrorCode
All Implemented Interfaces:
Serializable, Comparable<EmailErrorCode>, Constable

public enum EmailErrorCode extends Enum<EmailErrorCode>
Email Error Code Enumeration 邮件错误码枚举

Defines all error codes for email operations.

定义所有邮件操作的错误码。

Features | 主要功能:

  • Categorized error codes - 分类的错误码
  • Retryable flag for automatic retry - 可重试标志用于自动重试
  • Exception mapping support - 异常映射支持

Error Code Ranges | 错误码范围:

  • 1xxx - Configuration errors - 配置错误
  • 2xxx - Connection errors - 连接错误
  • 3xxx - Sending errors - 发送错误
  • 4xxx - Security errors - 安全错误
  • 5xxx - Template errors - 模板错误
  • 6xxx - Receiving errors - 接收错误

Usage Examples | 使用示例:

EmailErrorCode code = EmailErrorCode.fromException(cause);
if (code.isRetryable()) {
    // Schedule retry
}
Since:
JDK 25, opencode-base-email V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Enum Constant Details

    • UNKNOWN

      public static final EmailErrorCode UNKNOWN
      Unknown error - 未知错误
    • CONFIG_INVALID

      public static final EmailErrorCode CONFIG_INVALID
      Invalid configuration - 配置无效
    • AUTH_FAILED

      public static final EmailErrorCode AUTH_FAILED
      Authentication failed - 认证失败
    • CONNECTION_FAILED

      public static final EmailErrorCode CONNECTION_FAILED
      Connection failed - 连接失败
    • CONNECTION_TIMEOUT

      public static final EmailErrorCode CONNECTION_TIMEOUT
      Connection timeout - 连接超时
    • SEND_TIMEOUT

      public static final EmailErrorCode SEND_TIMEOUT
      Send timeout - 发送超时
    • RECIPIENT_REJECTED

      public static final EmailErrorCode RECIPIENT_REJECTED
      Recipient rejected - 收件人被拒绝
    • MESSAGE_REJECTED

      public static final EmailErrorCode MESSAGE_REJECTED
      Message rejected - 邮件被拒绝
    • MAILBOX_FULL

      public static final EmailErrorCode MAILBOX_FULL
      Mailbox full - 邮箱已满
    • RATE_LIMITED

      public static final EmailErrorCode RATE_LIMITED
      Rate limited - 发送频率超限
    • HEADER_INJECTION

      public static final EmailErrorCode HEADER_INJECTION
      Header injection detected - 邮件头注入
    • INVALID_ATTACHMENT

      public static final EmailErrorCode INVALID_ATTACHMENT
      Invalid attachment - 无效附件
    • TEMPLATE_ERROR

      public static final EmailErrorCode TEMPLATE_ERROR
      Template error - 模板错误
    • FOLDER_NOT_FOUND

      public static final EmailErrorCode FOLDER_NOT_FOUND
      Folder not found - 文件夹未找到
    • MESSAGE_NOT_FOUND

      public static final EmailErrorCode MESSAGE_NOT_FOUND
      Message not found - 消息未找到
    • RECEIVE_TIMEOUT

      public static final EmailErrorCode RECEIVE_TIMEOUT
      Receive timeout - 接收超时
    • FOLDER_ACCESS_DENIED

      public static final EmailErrorCode FOLDER_ACCESS_DENIED
      Folder access denied - 文件夹访问被拒绝
    • IDLE_NOT_SUPPORTED

      public static final EmailErrorCode IDLE_NOT_SUPPORTED
      IDLE not supported - IDLE不支持
    • PROTOCOL_NOT_SUPPORTED

      public static final EmailErrorCode PROTOCOL_NOT_SUPPORTED
      Protocol not supported - 协议不支持
    • ATTACHMENT_DOWNLOAD_FAILED

      public static final EmailErrorCode ATTACHMENT_DOWNLOAD_FAILED
      Attachment download failed - 附件下载失败
    • MESSAGE_PARSE_FAILED

      public static final EmailErrorCode MESSAGE_PARSE_FAILED
      Message parse failed - 消息解析失败
    • CONNECTION_LOST

      public static final EmailErrorCode CONNECTION_LOST
      Connection lost - 连接丢失
  • Method Details

    • values

      public static EmailErrorCode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static EmailErrorCode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getCode

      public int getCode()
      Get error code number 获取错误码数字
      Returns:
      the error code | 错误码
    • getDescription

      public String getDescription()
      Get error description in English 获取英文错误描述
      Returns:
      the description | 描述
    • getDescriptionCn

      public String getDescriptionCn()
      Get error description in Chinese 获取中文错误描述
      Returns:
      the description in Chinese | 中文描述
    • isRetryable

      public boolean isRetryable()
      Check if error is retryable 检查错误是否可重试
      Returns:
      true if retryable | 可重试返回true
    • fromException

      public static EmailErrorCode fromException(Throwable e)
      Get error code from exception 从异常获取错误码
      Parameters:
      e - the exception | 异常
      Returns:
      the error code | 错误码