@@ -152,11 +152,12 @@ class StatsigClient {
152
152
* @return the Dynamic Config backing the experiment
153
153
*/
154
154
@JvmOverloads
155
- fun getExperiment (user : StatsigUser , experimentName : String , option : GetExperimentOptions ? = null): DynamicConfig ? {
155
+ fun getExperiment (user : StatsigUser , experimentName : String , option : GetExperimentOptions ? = null): DynamicConfig {
156
+ var result = DynamicConfig .empty()
156
157
if (! isInitialized(" getExperiment" )) {
157
- return null
158
+ result.evaluationDetails = EvaluationDetails (0 ,EvaluationReason .UNINITIALIZED )
159
+ return result
158
160
}
159
- var result = DynamicConfig .empty()
160
161
errorBoundary.capture({
161
162
val normalizedUser = normalizeUser(user)
162
163
val evaluation = evaluator.getConfig(normalizedUser, experimentName, option?.userPersistedValues)
@@ -191,11 +192,12 @@ class StatsigClient {
191
192
* @return DynamicConfig object evaluated for the selected StatsigUser
192
193
*/
193
194
@JvmOverloads
194
- fun getConfig (user : StatsigUser , dynamicConfigName : String , option : GetConfigOptions ? = null): DynamicConfig ? {
195
- if (! isInitialized(" getConfig" )) {
196
- return null
197
- }
195
+ fun getConfig (user : StatsigUser , dynamicConfigName : String , option : GetConfigOptions ? = null): DynamicConfig {
198
196
var result = DynamicConfig .empty()
197
+ if (! isInitialized(" getExperiment" )) {
198
+ result.evaluationDetails = EvaluationDetails (0 ,EvaluationReason .UNINITIALIZED )
199
+ return result
200
+ }
199
201
errorBoundary.capture({
200
202
val normalizedUser = normalizeUser(user)
201
203
val evaluation = evaluator.getConfig(normalizedUser, dynamicConfigName)
@@ -229,11 +231,11 @@ class StatsigClient {
229
231
* @return the current layer values as a Layer object
230
232
*/
231
233
@JvmOverloads
232
- fun getLayer (user : StatsigUser , layerName : String , option : GetLayerOptions ? = null): Layer ? {
233
- if (! isInitialized(" getLayer" )) {
234
- return null
235
- }
234
+ fun getLayer (user : StatsigUser , layerName : String , option : GetLayerOptions ? = null): Layer {
236
235
var result = Layer .empty(layerName)
236
+ if (! isInitialized(" getExperiment" )) {
237
+ return result
238
+ }
237
239
errorBoundary.capture({
238
240
val normalizedUser = normalizeUser(user)
239
241
val evaluation = evaluator.getLayer(normalizedUser, layerName, option?.userPersistedValues)
0 commit comments