Skip to content

Conversation

@thomaszurkan-optimizely
Copy link
Contributor

No description provided.

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a 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?

userEvent := event.CreateConversionUserEvent(o.configManager.GetConfig(), configEvent, userContext, eventTags)
o.eventProcessor.ProcessEvent(userEvent)
} else {
logger.Error("Error getting event", err)
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and easy!

@thomaszurkan-optimizely thomaszurkan-optimizely changed the title (chore): add a track call (fix): add a track call Aug 22, 2019
@thomaszurkan-optimizely thomaszurkan-optimizely changed the title (fix): add a track call (feat): add a track call Aug 22, 2019
if !o.isValid {
errorMessage := "Optimizely instance is not valid. Failing GetEnabledFeatures."
err := errors.New(errorMessage)
logger.Error(errorMessage, nil)
Copy link
Contributor

@pawels-optimizely pawels-optimizely Aug 22, 2019

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

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)
Copy link
Contributor

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 ?

Copy link
Contributor Author

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

Copy link
Contributor

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

Copy link
Contributor

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 :=

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a 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

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it!

@thomaszurkan-optimizely thomaszurkan-optimizely merged commit 98c5a3a into go-alpha Aug 26, 2019
@mikeproeng37 mikeproeng37 deleted the addTrackCall branch August 28, 2019 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants