diff --git a/client/telemetry/TelemetryEventClient.go b/client/telemetry/TelemetryEventClient.go index bfa4bf15c2..df44eb6130 100644 --- a/client/telemetry/TelemetryEventClient.go +++ b/client/telemetry/TelemetryEventClient.go @@ -20,6 +20,7 @@ import ( "context" "encoding/base64" "encoding/json" + "errors" "fmt" cloudProviderIdentifier "github.com/devtron-labs/common-lib/cloud-provider-identifier" posthogTelemetry "github.com/devtron-labs/common-lib/telemetry" @@ -690,8 +691,13 @@ func (impl *TelemetryEventClientImpl) checkForOptOut(ctx context.Context, UCID s if err != nil { // this should be non-blocking call and should not fail the request for ucid getting impl.logger.Errorw("check opt-out list failed, rest api error", "ucid", UCID, "err", err) + return false, err + } + flag, ok := response["result"].(bool) + if !ok { + impl.logger.Errorw("check opt-out list failed, type assertion error", "ucid", UCID) + return false, errors.New("type assertion error") } - flag := response["result"].(bool) return flag, nil }