Class OpenRulesException

All Implemented Interfaces:
Serializable

public class OpenRulesException extends OpenException
Base Rules Exception for All Rule Engine Errors 所有规则引擎错误的基础异常

Base exception class for all rule-related errors in the rules component, providing detailed error information including rule name and error type.

规则组件中所有规则相关错误的基础异常类,提供包括规则名称和错误类型的详细错误信息。

Features | 主要功能:

  • Rule name tracking - 规则名称跟踪
  • Error type classification - 错误类型分类
  • Cause chaining - 原因链
  • Component identification - 组件标识

Usage Examples | 使用示例:

throw new OpenRulesException("Rule evaluation failed");
throw new OpenRulesException("Invalid rule", "rule-1",
    OpenRulesException.RuleErrorType.INVALID_DEFINITION);

Security | 安全性:

  • Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
  • Null-safe: Partial (message required, ruleName optional) - 空值安全: 部分(消息必需,规则名称可选)
Since:
JDK 25, opencode-base-rules V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • OpenRulesException

      public OpenRulesException(String message)
      Constructs a new rules exception with message 使用消息构造新的规则异常
      Parameters:
      message - the error message | 错误消息
    • OpenRulesException

      public OpenRulesException(String message, Throwable cause)
      Constructs a new rules exception with message and cause 使用消息和原因构造新的规则异常
      Parameters:
      message - the error message | 错误消息
      cause - the cause | 原因
    • OpenRulesException

      public OpenRulesException(OpenRulesException.RuleErrorType errorType, String message)
      Constructs a new rules exception with error type and message 使用错误类型和消息构造新的规则异常
      Parameters:
      errorType - the error type | 错误类型
      message - the error message | 错误消息
    • OpenRulesException

      public OpenRulesException(String message, String ruleName, OpenRulesException.RuleErrorType errorType)
      Constructs a new rules exception with full details 使用完整详情构造新的规则异常
      Parameters:
      message - the error message | 错误消息
      ruleName - the rule name | 规则名称
      errorType - the error type | 错误类型
    • OpenRulesException

      public OpenRulesException(String message, String ruleName, OpenRulesException.RuleErrorType errorType, Throwable cause)
      Constructs a new rules exception with full details and cause 使用完整详情和原因构造新的规则异常
      Parameters:
      message - the error message | 错误消息
      ruleName - the rule name | 规则名称
      errorType - the error type | 错误类型
      cause - the cause | 原因
  • Method Details

    • ruleName

      public String ruleName()
      Gets the name of the rule that caused the exception 获取导致异常的规则名称
      Returns:
      the rule name, or null if not specified | 规则名称,如果未指定则为null
    • errorType

      Gets the type of rule error that occurred 获取发生的规则错误类型
      Returns:
      the error type | 错误类型