Class EmailException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.email.exception.EmailException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
EmailConfigException, EmailReceiveException, EmailSecurityException, EmailSendException, EmailTemplateException
Email Exception Base Class
邮件异常基类
Base exception class for all email-related errors.
所有邮件相关错误的基类异常。
Features | 主要功能:
- Error code support - 错误码支持
- Email context preservation - 邮件上下文保留
- Retryable flag - 可重试标志
Usage Examples | 使用示例:
try {
OpenEmail.send(email);
} catch (EmailException e) {
if (e.isRetryable()) {
// Schedule for retry
}
log.error("Error code: {}", e.getEmailErrorCode().getCode());
}
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Since:
- JDK 25, opencode-base-email V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEmailException(String message) Create exception with message only 仅使用消息创建异常EmailException(String message, EmailErrorCode errorCode) Create exception with message and error code 使用消息和错误码创建异常EmailException(String message, Throwable cause) Create exception with message and cause 使用消息和原因创建异常EmailException(String message, Throwable cause, Email email, EmailErrorCode errorCode) Create exception with all parameters 使用所有参数创建异常 -
Method Summary
Modifier and TypeMethodDescriptiongetEmail()Get the related email (if available) 获取相关邮件(如果可用)Get the email error code 获取邮件错误码booleanCheck if error is retryable 检查错误是否可重试Methods inherited from class OpenException
getComponent, getErrorCode, getMessage, getRawMessageMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
EmailException
Create exception with message only 仅使用消息创建异常- Parameters:
message- the error message | 错误消息
-
EmailException
-
EmailException
Create exception with message and error code 使用消息和错误码创建异常- Parameters:
message- the error message | 错误消息errorCode- the error code | 错误码
-
EmailException
Create exception with all parameters 使用所有参数创建异常- Parameters:
message- the error message | 错误消息cause- the cause | 原因email- the related email | 相关邮件errorCode- the error code | 错误码
-
-
Method Details
-
getEmailErrorCode
Get the email error code 获取邮件错误码- Returns:
- the email error code | 邮件错误码
-
getEmail
Get the related email (if available) 获取相关邮件(如果可用)- Returns:
- the email or null | 邮件或null
-
isRetryable
public boolean isRetryable()Check if error is retryable 检查错误是否可重试- Returns:
- true if retryable | 可重试返回true
-