Class FeatureException

All Implemented Interfaces:
OpenExceptionMeta, Serializable
Direct Known Subclasses:
FeatureConfigException, FeatureExpiredException, FeatureNotFoundException, FeatureSecurityException, FeatureStoreException

public class FeatureException extends OpenException
Feature Exception Base Class 功能异常基类

Base exception class for all feature-related errors.

所有功能相关错误的基类异常。

Features | 主要功能:

  • Error code support - 错误码支持
  • Feature key context - 功能键上下文
  • Extends OpenException for unified exception handling - 扩展OpenException以统一异常处理

Usage Examples | 使用示例:

try {
    OpenFeature.getInstance().get("unknown");
} catch (FeatureException e) {
    log.error("Feature error: code={}, message={}",
        e.getFeatureErrorCode().getCode(), e.getMessage());
}

Security | 安全性:

  • Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
  • Null-safe: Partial (validates inputs) - 空值安全: 部分(验证输入)
Since:
JDK 25, opencode-base-feature V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • FeatureException

      public FeatureException(String message)
      Create exception with message 使用消息创建异常
      Parameters:
      message - the error message | 错误消息
    • FeatureException

      public FeatureException(String message, Throwable cause)
      Create exception with message and cause 使用消息和原因创建异常
      Parameters:
      message - the error message | 错误消息
      cause - the cause | 原因
    • FeatureException

      public FeatureException(String message, FeatureErrorCode errorCode)
      Create exception with message and error code 使用消息和错误码创建异常
      Parameters:
      message - the error message | 错误消息
      errorCode - the error code | 错误码
    • FeatureException

      public FeatureException(String message, Throwable cause, String featureKey, FeatureErrorCode errorCode)
      Create exception with all parameters 使用所有参数创建异常
      Parameters:
      message - the error message | 错误消息
      cause - the cause | 原因
      featureKey - the feature key | 功能键
      errorCode - the error code | 错误码
  • Method Details

    • getFeatureKey

      public String getFeatureKey()
      Get the feature key 获取功能键
      Returns:
      feature key or null | 功能键或null
    • getFeatureErrorCode

      public FeatureErrorCode getFeatureErrorCode()
      Get the feature error code 获取功能错误码
      Returns:
      error code | 错误码