Class OpenRulesException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.rules.exception.OpenRulesException
- All Implemented Interfaces:
OpenExceptionMeta, Serializable
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRule Error Type Enumeration 规则错误类型枚举 -
Constructor Summary
ConstructorsConstructorDescriptionOpenRulesException(OpenRulesException.RuleErrorType errorType, String message) Constructs a new rules exception with error type and message 使用错误类型和消息构造新的规则异常OpenRulesException(String message) Constructs a new rules exception with message 使用消息构造新的规则异常OpenRulesException(String message, String ruleName, OpenRulesException.RuleErrorType errorType) Constructs a new rules exception with full details 使用完整详情构造新的规则异常OpenRulesException(String message, String ruleName, OpenRulesException.RuleErrorType errorType, Throwable cause) Constructs a new rules exception with full details and cause 使用完整详情和原因构造新的规则异常OpenRulesException(String message, Throwable cause) Constructs a new rules exception with message and cause 使用消息和原因构造新的规则异常 -
Method Summary
Modifier and TypeMethodDescriptionGets the type of rule error that occurred 获取发生的规则错误类型ruleName()Gets the name of the rule that caused the 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
-
OpenRulesException
Constructs a new rules exception with message 使用消息构造新的规则异常- Parameters:
message- the error message | 错误消息
-
OpenRulesException
-
OpenRulesException
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
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 | 错误类型
-