Enum Class EmailErrorCode
- All Implemented Interfaces:
Serializable, Comparable<EmailErrorCode>, Constable
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAttachment download failed - 附件下载失败Authentication failed - 认证失败Invalid configuration - 配置无效Connection failed - 连接失败Connection lost - 连接丢失Connection timeout - 连接超时Folder access denied - 文件夹访问被拒绝Folder not found - 文件夹未找到Header injection detected - 邮件头注入IDLE not supported - IDLE不支持Invalid attachment - 无效附件Mailbox full - 邮箱已满Message not found - 消息未找到Message parse failed - 消息解析失败Message rejected - 邮件被拒绝Protocol not supported - 协议不支持Rate limited - 发送频率超限Receive timeout - 接收超时Recipient rejected - 收件人被拒绝Send timeout - 发送超时Template error - 模板错误Unknown error - 未知错误 -
Method Summary
Modifier and TypeMethodDescriptionstatic EmailErrorCodeGet error code from exception 从异常获取错误码intgetCode()Get error code number 获取错误码数字Get error description in English 获取英文错误描述Get error description in Chinese 获取中文错误描述booleanCheck if error is retryable 检查错误是否可重试static EmailErrorCodeReturns the enum constant of this class with the specified name.static EmailErrorCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UNKNOWN
Unknown error - 未知错误 -
CONFIG_INVALID
Invalid configuration - 配置无效 -
AUTH_FAILED
Authentication failed - 认证失败 -
CONNECTION_FAILED
Connection failed - 连接失败 -
CONNECTION_TIMEOUT
Connection timeout - 连接超时 -
SEND_TIMEOUT
Send timeout - 发送超时 -
RECIPIENT_REJECTED
Recipient rejected - 收件人被拒绝 -
MESSAGE_REJECTED
Message rejected - 邮件被拒绝 -
MAILBOX_FULL
Mailbox full - 邮箱已满 -
RATE_LIMITED
Rate limited - 发送频率超限 -
HEADER_INJECTION
Header injection detected - 邮件头注入 -
INVALID_ATTACHMENT
Invalid attachment - 无效附件 -
TEMPLATE_ERROR
Template error - 模板错误 -
FOLDER_NOT_FOUND
Folder not found - 文件夹未找到 -
MESSAGE_NOT_FOUND
Message not found - 消息未找到 -
RECEIVE_TIMEOUT
Receive timeout - 接收超时 -
FOLDER_ACCESS_DENIED
Folder access denied - 文件夹访问被拒绝 -
IDLE_NOT_SUPPORTED
IDLE not supported - IDLE不支持 -
PROTOCOL_NOT_SUPPORTED
Protocol not supported - 协议不支持 -
ATTACHMENT_DOWNLOAD_FAILED
Attachment download failed - 附件下载失败 -
MESSAGE_PARSE_FAILED
Message parse failed - 消息解析失败 -
CONNECTION_LOST
Connection lost - 连接丢失
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
getCode
public int getCode()Get error code number 获取错误码数字- Returns:
- the error code | 错误码
-
getDescription
Get error description in English 获取英文错误描述- Returns:
- the description | 描述
-
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
Get error code from exception 从异常获取错误码- Parameters:
e- the exception | 异常- Returns:
- the error code | 错误码
-