Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
include featureKey in wrong-type log message (#321)
Browse files Browse the repository at this point in the history
**Requirements**

- [ ] I have added test coverage for new or changed functionality
- [x] I have followed the repository's [pull request submission
guidelines](../blob/master/CONTRIBUTING.md#submitting-pull-requests)
- [ ] I have validated my changes against all supported platform
versions

**Describe the solution you've provided**

Currently type errors do not include the name of the feature, which is a
key ingredient to troubleshooting this error class. This adds the
`featureKey` to the error message.

**Describe alternatives you've considered**

None
  • Loading branch information
tanderson-ld authored Jan 8, 2024
2 parents cbec479 + 0ce65a3 commit 508b895
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/launchdarkly/sdk/server/LDClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ private EvalResultAndFlag evalAndFlag(String featureKey, LDContext context, LDVa
if (requireType != null &&
!value.isNull() &&
value.getType() != requireType) {
evaluationLogger.error("Feature flag evaluation expected result as {}, but got {}", defaultValue.getType(), value.getType());
evaluationLogger.error("Feature flag \"{}\"; evaluation expected result as {}, but got {}", featureKey, defaultValue.getType(), value.getType());
recordEvaluationErrorEvent(featureFlag, context, defaultValue, EvaluationReason.ErrorKind.WRONG_TYPE, withDetail);
return new EvalResultAndFlag(errorResult(EvaluationReason.ErrorKind.WRONG_TYPE, defaultValue), featureFlag);
}
Expand Down

0 comments on commit 508b895

Please sign in to comment.