diff --git a/src/main/java/dev/openfeature/sdk/OpenFeatureClient.java b/src/main/java/dev/openfeature/sdk/OpenFeatureClient.java index 8c86a7212..4467900df 100644 --- a/src/main/java/dev/openfeature/sdk/OpenFeatureClient.java +++ b/src/main/java/dev/openfeature/sdk/OpenFeatureClient.java @@ -11,7 +11,7 @@ import dev.openfeature.sdk.exceptions.OpenFeatureError; import dev.openfeature.sdk.internal.AutoCloseableLock; import dev.openfeature.sdk.internal.AutoCloseableReentrantReadWriteLock; -import dev.openfeature.sdk.internal.ErrorUtils; +import dev.openfeature.sdk.exceptions.ExceptionUtils; import dev.openfeature.sdk.internal.ObjectUtils; import lombok.Getter; import lombok.extern.slf4j.Slf4j; @@ -127,7 +127,8 @@ private FlagEvaluationDetails evaluateFlag(FlagValueType type, String key details = FlagEvaluationDetails.from(providerEval, key); if (details.getErrorCode() != null) { - Exception e = ErrorUtils.instantiateErrorByErrorCode(details.getErrorCode(), details.getErrorMessage()); + Exception e = ExceptionUtils.instantiateErrorByErrorCode(details.getErrorCode(), + details.getErrorMessage()); hookSupport.errorHooks(type, hookCtx, e, mergedHooks, hints); } else { hookSupport.afterHooks(type, hookCtx, details, mergedHooks, hints); diff --git a/src/main/java/dev/openfeature/sdk/internal/ErrorUtils.java b/src/main/java/dev/openfeature/sdk/exceptions/ExceptionUtils.java similarity index 69% rename from src/main/java/dev/openfeature/sdk/internal/ErrorUtils.java rename to src/main/java/dev/openfeature/sdk/exceptions/ExceptionUtils.java index e4989a167..28c7cd716 100644 --- a/src/main/java/dev/openfeature/sdk/internal/ErrorUtils.java +++ b/src/main/java/dev/openfeature/sdk/exceptions/ExceptionUtils.java @@ -1,19 +1,11 @@ -package dev.openfeature.sdk.internal; +package dev.openfeature.sdk.exceptions; import dev.openfeature.sdk.ErrorCode; -import dev.openfeature.sdk.exceptions.FlagNotFoundError; -import dev.openfeature.sdk.exceptions.GeneralError; -import dev.openfeature.sdk.exceptions.InvalidContextError; -import dev.openfeature.sdk.exceptions.OpenFeatureError; -import dev.openfeature.sdk.exceptions.ParseError; -import dev.openfeature.sdk.exceptions.ProviderNotReadyError; -import dev.openfeature.sdk.exceptions.TargetingKeyMissingError; -import dev.openfeature.sdk.exceptions.TypeMismatchError; import lombok.experimental.UtilityClass; @SuppressWarnings("checkstyle:MissingJavadocType") @UtilityClass -public class ErrorUtils { +public class ExceptionUtils { /** * Creates an Error for the specific error code. diff --git a/src/test/java/dev/openfeature/sdk/internal/ErrorUtilsTest.java b/src/test/java/dev/openfeature/sdk/exceptions/ExceptionUtilsTest.java similarity index 75% rename from src/test/java/dev/openfeature/sdk/internal/ErrorUtilsTest.java rename to src/test/java/dev/openfeature/sdk/exceptions/ExceptionUtilsTest.java index ded56c45c..58e594575 100644 --- a/src/test/java/dev/openfeature/sdk/internal/ErrorUtilsTest.java +++ b/src/test/java/dev/openfeature/sdk/exceptions/ExceptionUtilsTest.java @@ -1,14 +1,6 @@ -package dev.openfeature.sdk.internal; +package dev.openfeature.sdk.exceptions; import dev.openfeature.sdk.ErrorCode; -import dev.openfeature.sdk.exceptions.FlagNotFoundError; -import dev.openfeature.sdk.exceptions.GeneralError; -import dev.openfeature.sdk.exceptions.InvalidContextError; -import dev.openfeature.sdk.exceptions.OpenFeatureError; -import dev.openfeature.sdk.exceptions.ParseError; -import dev.openfeature.sdk.exceptions.ProviderNotReadyError; -import dev.openfeature.sdk.exceptions.TargetingKeyMissingError; -import dev.openfeature.sdk.exceptions.TypeMismatchError; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.params.ParameterizedTest; @@ -21,7 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertInstanceOf; -class ErrorUtilsTest { +class ExceptionUtilsTest { @ParameterizedTest @DisplayName("should produce correct exception for a provided ErrorCode") @@ -29,7 +21,7 @@ class ErrorUtilsTest { void shouldProduceCorrectExceptionForErrorCode(ErrorCode errorCode, Class exception) { String errorMessage = "error message"; - OpenFeatureError openFeatureError = ErrorUtils.instantiateErrorByErrorCode(errorCode, errorMessage); + OpenFeatureError openFeatureError = ExceptionUtils.instantiateErrorByErrorCode(errorCode, errorMessage); assertInstanceOf(exception, openFeatureError); assertThat(openFeatureError.getMessage()).isEqualTo(errorMessage); assertThat(openFeatureError.getErrorCode()).isEqualByComparingTo(errorCode);