Class GraphException

All Implemented Interfaces:
OpenExceptionMeta, Serializable
Direct Known Subclasses:
CycleDetectedException, EdgeNotFoundException, GraphLimitExceededException, GraphTimeoutException, InvalidEdgeException, InvalidVertexException, NoPathException, VertexNotFoundException

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

Base exception class for all graph-related exceptions.

所有图相关异常的基类。

Features | 主要功能:

  • Carries GraphErrorCode for programmatic error handling - 携带GraphErrorCode用于程序化错误处理
  • Base class for all graph exceptions - 所有图异常的基类
  • Extends OpenException for unified exception hierarchy - 继承OpenException统一异常体系

Usage Examples | 使用示例:

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

Security | 安全性:

  • Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
  • Null-safe: Yes - 空值安全: 是
Since:
JDK 25, opencode-base-graph V1.0.3
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

    • getGraphErrorCode

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