Skip to content

Commit

Permalink
fix(install): remove duplicate tracking event and simplify error mess…
Browse files Browse the repository at this point in the history
…age (#1521)
  • Loading branch information
Julien4218 authored Oct 12, 2023
1 parent 6634468 commit 086905d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions internal/install/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ var Command = &cobra.Command{

detailErr := validateProfile(config.DefaultMaxTimeoutSeconds, sg)
if detailErr != nil {
sg.Track(detailErr.EventName)
log.Fatal(detailErr)
}

Expand Down Expand Up @@ -165,8 +164,9 @@ func validateProfile(maxTimeoutSeconds int, sg *segment.Segment) *types.DetailEr
licenseKey, err := client.FetchLicenseKey(accountID, config.FlagProfileName, &maxTimeoutSeconds)
if err != nil {
errorOccured = true
details := fmt.Sprintf("could not fetch license key for account %d:, license key: %v %s", accountID, utils.Obfuscate(licenseKey), err)
detailErr = types.NewDetailError(types.EventTypes.UnableToFetchLicenseKey, details)
message := fmt.Sprintf("could not fetch license key for account %d:, license key: %v %s", accountID, utils.Obfuscate(licenseKey), err)
log.Debug(message)
detailErr = types.NewDetailError(types.EventTypes.UnableToFetchLicenseKey, fmt.Sprintf("%s", err))
return detailErr
}

Expand Down
7 changes: 4 additions & 3 deletions internal/synthetics/command_batch_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import (
"os"
"time"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"

"github.com/newrelic/newrelic-cli/internal/client"
configAPI "github.com/newrelic/newrelic-cli/internal/config/api"
"github.com/newrelic/newrelic-cli/internal/install/ux"
"github.com/newrelic/newrelic-cli/internal/output"
"github.com/newrelic/newrelic-cli/internal/utils"
"github.com/newrelic/newrelic-client-go/v2/pkg/synthetics"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion internal/synthetics/command_monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ package synthetics
import (
"testing"

"github.com/newrelic/newrelic-cli/internal/testcobra"
"github.com/stretchr/testify/assert"

"github.com/newrelic/newrelic-cli/internal/testcobra"
)

func TestSyntheticsMonitor(t *testing.T) {
Expand Down

0 comments on commit 086905d

Please sign in to comment.