Class GraphException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.graph.exception.GraphException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CycleDetectedException, EdgeNotFoundException, GraphLimitExceededException, GraphTimeoutException, InvalidEdgeException, InvalidVertexException, NoPathException, VertexNotFoundException

public class GraphException extends RuntimeException
Graph Exception 图异常基类

Base exception class for all graph-related exceptions.

所有图相关异常的基类。

Features | 主要功能:

  • Carries GraphErrorCode for programmatic error handling - 携带GraphErrorCode用于程序化错误处理
  • Base class for all graph exceptions - 所有图异常的基类

Usage Examples | 使用示例:

try {
    OpenGraph.topologicalSort(graph);
} catch (GraphException e) {
    GraphErrorCode code = e.getErrorCode();
}

Security | 安全性:

  • Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
  • Null-safe: Yes - 空值安全: 是
Since:
JDK 25, opencode-base-graph V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • GraphException

      public GraphException(String message, GraphErrorCode errorCode)
      Create graph exception 创建图异常
      Parameters:
      message - the error message | 错误消息
      errorCode - the error code | 错误码
    • GraphException

      public GraphException(String message, Throwable cause, GraphErrorCode errorCode)
      Create graph exception with cause 创建带原因的图异常
      Parameters:
      message - the error message | 错误消息
      cause - the cause | 原因
      errorCode - the error code | 错误码
  • Method Details

    • getErrorCode

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