Skip to content

Commit bc7bff7

Browse files
committed
code review changes
1 parent 2e62397 commit bc7bff7

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

framework/tracking/dx.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ func NewDxTracker(APITokenVariableName string, product Product) (Tracker, error)
156156
return t, nil
157157
}
158158

159-
func (t *DxTracker) buildConfigWithGhCLI(APITokenVariableName, product string, existinConfig *config) (*config, error) {
159+
func (t *DxTracker) buildConfigWithGhCLI(APITokenVariableName, product string, existingConfig *config) (*config, error) {
160160
var userNameErr error
161161
var c *config
162162

163-
if existinConfig != nil {
164-
c = existinConfig
163+
if existingConfig != nil {
164+
c = existingConfig
165165
} else {
166166
c = &config{}
167167
}
@@ -280,7 +280,13 @@ func (t *DxTracker) sendEvent(name string, timestamp int64, metadata map[string]
280280
}
281281

282282
if !dxResp.Ok {
283-
return fmt.Errorf("failed to send event, error: %s", *dxResp.Error)
283+
var errMsg string
284+
if dxResp.Error != nil {
285+
errMsg = *dxResp.Error
286+
} else {
287+
errMsg = "unknown error"
288+
}
289+
return fmt.Errorf("failed to send event, error: %s", errMsg)
284290
}
285291

286292
return nil

framework/tracking/dx_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestDXOverlyLongMetadataTruncation(t *testing.T) {
2727
require.NotEqual(t, metadata["to_truncate"], truncated["to_truncate"], "to_truncate should be truncated")
2828
}
2929

30-
func TestDXOnlyOneOveryLongMetadataTruncationNoPriority(t *testing.T) {
30+
func TestDXOnlyOneOverlyLongMetadataTruncationNoPriority(t *testing.T) {
3131
metadata := map[string]any{
3232
"to_truncate": "abcde" + strings.Repeat("1234567890", 110), // overly long
3333
"do_not_truncate": "abcde" + strings.Repeat("1234567890", 50),

0 commit comments

Comments
 (0)