Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import dev.openfeature.sdk.ProviderEvent;
import dev.openfeature.sdk.Reason;
import dev.openfeature.sdk.Value;
import dev.openfeature.sdk.exceptions.FlagNotFoundError;
import dev.openfeature.sdk.exceptions.ParseError;
import dev.openfeature.sdk.exceptions.TypeMismatchError;
import java.util.Map;
Expand Down Expand Up @@ -203,6 +204,12 @@ private <T> ProviderEvaluation<T> resolve(Class<T> type, String key, EvaluationC
// check variant existence
Object value = flag.getVariants().get(resolvedVariant);
if (value == null) {
if (resolvedVariant.isEmpty()) {
String message = String.format("no default variant found in flag with key %s", key);
log.debug(message);
throw new FlagNotFoundError(message);
}

String message = String.format("variant %s not found in flag with key %s", resolvedVariant, key);
log.debug(message);
throw new TypeMismatchError(message);
Expand Down