in pkg/confidence/utils.go [270:299]
func ToFloatResolutionDetail(res InterfaceResolutionDetail,
defaultValue float64) FloatResolutionDetail {
if res.ResolutionDetail.Reason == TargetingMatchReason {
v, ok := res.Value.(float64)
if ok {
return FloatResolutionDetail{
Value: v,
ResolutionDetail: res.ResolutionDetail,
}
}
err := NewTypeMismatchResolutionError("Unable to convert response property to float")
return FloatResolutionDetail{
Value: defaultValue,
ResolutionDetail: ResolutionDetail{
Variant: "",
Reason: ErrorReason,
ErrorCode: err.code,
ErrorMessage: err.message,
FlagMetadata: nil,
},
}
}
return FloatResolutionDetail{
Value: defaultValue,
ResolutionDetail: res.ResolutionDetail,
}
}