Class EmailReceiveException

All Implemented Interfaces:
Serializable

public class EmailReceiveException extends EmailException
Email Receive Exception 邮件接收异常

Exception thrown when email receiving fails.

邮件接收失败时抛出的异常。

Examples | 示例:

  • Connection failed - 连接失败
  • Authentication failed - 认证失败
  • Folder not found - 文件夹未找到
  • Receive timeout - 接收超时
  • Message parse failed - 消息解析失败

Features | 主要功能:

  • Folder and message context tracking - 文件夹和消息上下文跟踪
  • Factory methods for common receive errors - 常见接收错误的工厂方法
  • Error code support - 错误码支持

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 Details

    • EmailReceiveException

      public EmailReceiveException(String message)
      Create receive exception with message 使用消息创建接收异常
      Parameters:
      message - the error message | 错误消息
    • EmailReceiveException

      public EmailReceiveException(String message, EmailErrorCode errorCode)
      Create receive exception with message and error code 使用消息和错误码创建接收异常
      Parameters:
      message - the error message | 错误消息
      errorCode - the error code | 错误码
    • EmailReceiveException

      public EmailReceiveException(String message, Throwable cause)
      Create receive exception with message and cause 使用消息和原因创建接收异常
      Parameters:
      message - the error message | 错误消息
      cause - the cause | 原因
    • EmailReceiveException

      public EmailReceiveException(String message, Throwable cause, EmailErrorCode errorCode)
      Create receive exception with message, cause and error code 使用消息、原因和错误码创建接收异常
      Parameters:
      message - the error message | 错误消息
      cause - the cause | 原因
      errorCode - the error code | 错误码
    • EmailReceiveException

      public EmailReceiveException(String message, Throwable cause, EmailErrorCode errorCode, String folder, String messageId, ReceivedEmail receivedEmail)
      Create receive exception with full context 使用完整上下文创建接收异常
      Parameters:
      message - the error message | 错误消息
      cause - the cause | 原因
      errorCode - the error code | 错误码
      folder - the folder name | 文件夹名称
      messageId - the message ID | 消息ID
      receivedEmail - the partial received email | 部分接收的邮件
  • Method Details

    • getReceivedEmail

      public ReceivedEmail getReceivedEmail()
      Get the partially received email (if available) 获取部分接收的邮件(如果可用)
      Returns:
      the received email or null | 接收的邮件或null
    • getFolder

      public String getFolder()
      Get the folder where error occurred 获取发生错误的文件夹
      Returns:
      the folder name or null | 文件夹名称或null
    • getMessageId

      public String getMessageId()
      Get the message ID related to the error 获取与错误相关的消息ID
      Returns:
      the message ID or null | 消息ID或null
    • folderNotFound

      public static EmailReceiveException folderNotFound(String folder)
      Create exception for folder not found 创建文件夹未找到异常
      Parameters:
      folder - the folder name | 文件夹名称
      Returns:
      the exception | 异常
    • messageNotFound

      public static EmailReceiveException messageNotFound(String messageId)
      Create exception for message not found 创建消息未找到异常
      Parameters:
      messageId - the message ID | 消息ID
      Returns:
      the exception | 异常
    • connectionLost

      public static EmailReceiveException connectionLost(Throwable cause)
      Create exception for connection lost 创建连接丢失异常
      Parameters:
      cause - the cause | 原因
      Returns:
      the exception | 异常
    • timeout

      public static EmailReceiveException timeout()
      Create exception for receive timeout 创建接收超时异常
      Returns:
      the exception | 异常
    • parseFailed

      public static EmailReceiveException parseFailed(String messageId, Throwable cause)
      Create exception for message parse failure 创建消息解析失败异常
      Parameters:
      messageId - the message ID | 消息ID
      cause - the cause | 原因
      Returns:
      the exception | 异常