Class ImageException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.image.exception.ImageException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ImageFormatException, ImageIOException, ImageOperationException, ImageResourceException, ImageValidationException

public class ImageException extends RuntimeException
Image Exception 图片异常基类

Base exception class for all image processing exceptions.

所有图片处理异常的基类。

Features | 主要功能:

  • Base exception for all image processing errors - 所有图片处理错误的基础异常
  • Carries ImageErrorCode for programmatic error handling - 携带 ImageErrorCode 用于编程式错误处理

Usage Examples | 使用示例:

// Catch specific exception
try {
    OpenImage.read(path);
} catch (ImageException e) {
    System.err.println(e.getMessage());
}

Security | 安全性:

  • Thread-safe: Yes (immutable exception) - 线程安全: 是(不可变异常)
  • Null-safe: No (message must not be null) - 空值安全: 否(消息不能为 null)
Since:
JDK 25, opencode-base-image V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • ImageException

      public ImageException(String message, ImageErrorCode errorCode)
      Create an image exception with message and error code 创建带消息和错误码的图片异常
      Parameters:
      message - the error message | 错误消息
      errorCode - the error code | 错误码
    • ImageException

      public ImageException(String message, Throwable cause, ImageErrorCode errorCode)
      Create an image exception with message, cause and error code 创建带消息、原因和错误码的图片异常
      Parameters:
      message - the error message | 错误消息
      cause - the cause | 原因
      errorCode - the error code | 错误码
    • ImageException

      public ImageException(String message)
      Create an image exception with message 创建带消息的图片异常
      Parameters:
      message - the error message | 错误消息
    • ImageException

      public ImageException(String message, Throwable cause)
      Create an image exception with message and cause 创建带消息和原因的图片异常
      Parameters:
      message - the error message | 错误消息
      cause - the cause | 原因
  • Method Details

    • getErrorCode

      public ImageErrorCode getErrorCode()
      Get the error code 获取错误码
      Returns:
      the error code | 错误码