-
Notifications
You must be signed in to change notification settings - Fork 19
(feat): add a track call #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
mikeproeng37
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. Can you please add unit tests for it and also rename the PR to feat from chore since this is adding a new feature?
optimizely/client/client.go
Outdated
| userEvent := event.CreateConversionUserEvent(o.configManager.GetConfig(), configEvent, userContext, eventTags) | ||
| o.eventProcessor.ProcessEvent(userEvent) | ||
| } else { | ||
| logger.Error("Error getting event", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include the event key in the message
|
|
||
| if err == nil { | ||
| userEvent := event.CreateConversionUserEvent(o.configManager.GetConfig(), configEvent, userContext, eventTags) | ||
| o.eventProcessor.ProcessEvent(userEvent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and easy!
optimizely/client/client.go
Outdated
| if !o.isValid { | ||
| errorMessage := "Optimizely instance is not valid. Failing GetEnabledFeatures." | ||
| err := errors.New(errorMessage) | ||
| logger.Error(errorMessage, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.Error takes nil ?
something like this could be better:
err = errors.New("Optimizely instance is not valid. Failing GetEnabledFeatures.")
logger.Error("",err) or logger.Error(err.String(), err) // kind of redundant
return err
optimizely/client/client.go
Outdated
| defer func() { | ||
| if r := recover(); r != nil { | ||
| errorMessage := fmt.Sprintf(`Optimizely SDK is panicking with the error "%s"`, string(debug.Stack())) | ||
| err := errors.New(errorMessage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want to return that err ? or just created for logger ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's in a defer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not going to change the value of the error returned that's why I am asking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah he's right @thomaszurkan-optimizely, you need to name the variable in the return part of the function signature to (err error) so that you can assign err = errors.New(errorMessage instead of using :=
mikeproeng37
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
mikeproeng37
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See message on error message
mikeproeng37
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it!
No description provided.