Skip to content
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

fix: logging nil project config, adding more meaningful error messages #220

Merged
merged 2 commits into from Dec 31, 2019

Conversation

pawels-optimizely
Copy link
Contributor

Summary

Activate() returned vague runtime error (referencing null pointer). After analysis and debugging, found 2 scenarios causing this:

  • nil project config
  • decision context is empty but variation is not nil somehow.

Added some protective logic against null references across client methods.

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, just have a small nit

@@ -477,6 +478,9 @@ func (o *OptimizelyClient) RemoveOnTrack(id int) error {

func (o *OptimizelyClient) getProjectConfig() (projectConfig config.ProjectConfig, err error) {

if isNil(o.ConfigManager) {
return nil, errors.New("project config is not initialized")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be project config manager is not initialized

@pawels-optimizely pawels-optimizely merged commit 172b0ec into master Dec 31, 2019
@pawels-optimizely pawels-optimizely deleted the pawel/OASIS-5756 branch December 31, 2019 00:47
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.

None yet

2 participants