Class ImageException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.image.exception.ImageException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ImageFormatException, ImageIOException, ImageOperationException, ImageResourceException, ImageValidationException
Image Exception - Base exception for all image processing exceptions
图片异常基类 - 所有图片处理异常的基类
Base exception class for all image processing exceptions.
Extends OpenException to integrate with the unified OpenCode exception hierarchy.
所有图片处理异常的基类。继承 OpenException 以集成到统一的 OpenCode 异常体系中。
Features | 主要功能:
- Base exception for all image processing errors - 所有图片处理错误的基础异常
- Carries ImageErrorCode for programmatic error handling - 携带 ImageErrorCode 用于编程式错误处理
- Integrates with OpenException (component="Image") - 集成 OpenException(组件="Image")
Usage Examples | 使用示例:
// Catch specific exception
try {
OpenImage.read(path);
} catch (ImageException e) {
System.err.println(e.getRawMessage());
ImageErrorCode code = e.getImageErrorCode();
}
Security | 安全性:
- Thread-safe: Yes (immutable exception) - 线程安全: 是(不可变异常)
- Null-safe: No (message must not be null) - 空值安全: 否(消息不能为 null)
- Since:
- JDK 25, opencode-base-image V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionImageException(String message) Create an image exception with message 创建带消息的图片异常ImageException(String message, ImageErrorCode errorCode) Create an image exception with message and error code 创建带消息和错误码的图片异常ImageException(String message, Throwable cause) Create an image exception with message and cause 创建带消息和原因的图片异常ImageException(String message, Throwable cause, ImageErrorCode errorCode) Create an image exception with message, cause and error code 创建带消息、原因和错误码的图片异常 -
Method Summary
Modifier and TypeMethodDescriptionGet the image error code enum 获取图片错误码枚举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
-
ImageException
Create an image exception with message and error code 创建带消息和错误码的图片异常- Parameters:
message- the error message | 错误消息errorCode- the error code | 错误码
-
ImageException
Create an image exception with message, cause and error code 创建带消息、原因和错误码的图片异常- Parameters:
message- the error message | 错误消息cause- the cause | 原因errorCode- the error code | 错误码
-
ImageException
Create an image exception with message 创建带消息的图片异常- Parameters:
message- the error message | 错误消息
-
ImageException
-
-
Method Details
-
getImageErrorCode
Get the image error code enum 获取图片错误码枚举Returns the typed
ImageErrorCodeenum. For the String error code inherited fromOpenException, useOpenException.getErrorCode().返回类型化的
ImageErrorCode枚举。若需要从OpenException继承的 String 错误码,请使用OpenException.getErrorCode()。- Returns:
- the image error code enum | 图片错误码枚举
-