launchdarkly / java-server-sdk

LaunchDarkly Server-Side SDK for Java
Other
83 stars 56 forks source link

EvaluationException error message does not include feature flag key. #132

Closed alexwei closed 6 years ago

alexwei commented 6 years ago

Our codebase has async requests coming in to evaluate feature flag, and we have seen some flags assuming different result type when what is set on LD, but it's very hard for us to find out the culprit flag.

com.launchdarkly.client.EvaluationException: Feature flag evaluation expected result as string type, but got non-string type.
at com.launchdarkly.client.VariationType$4.assertResultType(VariationType.java:40)
at com.launchdarkly.client.LDClient.evaluate(LDClient.java:369)
at com.launchdarkly.client.LDClient.stringVariation(LDClient.java:298)

It would be helpful if the error message actually includes the key of the flag.

eli-darkly commented 6 years ago

That's true. We'll have a fix for this soon.

Related: the stacktraces for exceptions like this are not particularly useful - we should be logging them only at debug level.

eli-darkly commented 6 years ago

This has been fixed in version 4.2.2. Thanks for pointing it out.

ZhDev commented 1 year ago

The issue is still present in the code, the flag key is not being logged: https://github.com/launchdarkly/java-server-sdk/blob/13d01ff4536de42d0445cd3ab93859fa84c861d3/src/main/java/com/launchdarkly/sdk/server/LDClient.java#L509