Class TreeException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.tree.exception.TreeException
- All Implemented Interfaces:
OpenExceptionMeta, Serializable
- Direct Known Subclasses:
CycleDetectedException
Tree Exception - Base exception for tree operations
树异常 - 树操作的基础异常
Extends OpenException to integrate with the unified OpenCode exception hierarchy.
继承 OpenException 以集成统一的 OpenCode 异常体系。
Features | 主要功能:
- Base exception for tree operations - 树操作的基础异常
- Error code support via
TreeErrorCode- 通过 TreeErrorCode 支持错误码 - Factory methods for common errors - 常见错误的工厂方法
- Integrates with OpenException (component="Tree") - 集成 OpenException(组件="Tree")
Usage Examples | 使用示例:
throw TreeException.duplicateId(nodeId);
throw TreeException.nodeNotFound(nodeId);
throw TreeException.maxDepthExceeded(1000);
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 是(构造后不可变)
- Null-safe: No (message should not be null) - 否(消息不应为null)
- Since:
- JDK 25, opencode-base-tree V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTreeException(TreeErrorCode errorCode) Creates a tree exception with error code enum 创建树异常(带错误码枚举)TreeException(TreeErrorCode errorCode, String message) Creates a tree exception with error code enum and custom message 创建树异常(带错误码枚举和自定义消息)TreeException(TreeErrorCode errorCode, Throwable cause) Creates a tree exception with error code enum and cause 创建树异常(带错误码枚举和原因)TreeException(String message) Creates a tree exception with message 创建树异常(带消息)TreeException(String code, String message) Creates a tree exception with code and message 创建树异常(带错误码和消息)TreeException(String message, Throwable cause) Creates a tree exception with message and cause 创建树异常(带消息和原因) -
Method Summary
Modifier and TypeMethodDescriptionstatic TreeExceptionbuildFailed(String message) Creates a build-failed exception 创建构建失败异常static TreeExceptionduplicateId(Object id) Creates a duplicate-id exception 创建重复ID异常getCode()Gets the tree-specific error code 获取树特定的错误码static TreeExceptioninvalidNode(String message) Creates an invalid-node exception 创建无效节点异常static TreeExceptionmaxDepthExceeded(int maxDepth) Creates a max-depth-exceeded exception 创建超过最大深度异常static TreeExceptionnodeNotFound(Object id) Creates a node-not-found exception 创建节点未找到异常static TreeExceptionparentNotFound(Object parentId) Creates a parent-not-found exception 创建父节点未找到异常Methods inherited from class OpenException
getComponent, getErrorCode, getMessage, getRawMessageMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface OpenExceptionMeta
getMetaPrefix
-
Constructor Details
-
TreeException
Creates a tree exception with message 创建树异常(带消息)- Parameters:
message- the error message | 错误消息
-
TreeException
-
TreeException
Creates a tree exception with error code enum 创建树异常(带错误码枚举)- Parameters:
errorCode- the error code enum | 错误码枚举
-
TreeException
Creates a tree exception with error code enum and custom message 创建树异常(带错误码枚举和自定义消息)- Parameters:
errorCode- the error code enum | 错误码枚举message- the custom message | 自定义消息
-
TreeException
-
TreeException
Creates a tree exception with error code enum and cause 创建树异常(带错误码枚举和原因)- Parameters:
errorCode- the error code enum | 错误码枚举cause- the cause | 原因
-
-
Method Details
-
getCode
Gets the tree-specific error code 获取树特定的错误码- Returns:
- the error code string | 错误码字符串
-
buildFailed
Creates a build-failed exception 创建构建失败异常- Parameters:
message- the error message | 错误消息- Returns:
- the exception | 异常
-
invalidNode
Creates an invalid-node exception 创建无效节点异常- Parameters:
message- the error message | 错误消息- Returns:
- the exception | 异常
-
duplicateId
Creates a duplicate-id exception 创建重复ID异常- Parameters:
id- the duplicate ID | 重复的ID- Returns:
- the exception | 异常
-
parentNotFound
Creates a parent-not-found exception 创建父节点未找到异常- Parameters:
parentId- the parent ID | 父节点ID- Returns:
- the exception | 异常
-
nodeNotFound
Creates a node-not-found exception 创建节点未找到异常- Parameters:
id- the node ID | 节点ID- Returns:
- the exception | 异常
-
maxDepthExceeded
Creates a max-depth-exceeded exception 创建超过最大深度异常- Parameters:
maxDepth- the max depth | 最大深度- Returns:
- the exception | 异常
-