Skip to content

fix(project config manager): Don't log an error when not initialized with datafile #589

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

Merged

Conversation

mjc1283
Copy link
Contributor

@mjc1283 mjc1283 commented Oct 5, 2020

Summary

Fixes a regression introduced during refactoring for datafile accessor - any time the datafile property of the object passed to createInstance is missing or falsy, the logger will output (for example):

[OPTIMIZELY] - ERROR 2020-10-05T23:38:15.224Z CONFIG_VALIDATOR: No datafile specified. Cannot start optimizely

Passing in an sdkKey, but no datafile, is valid and supported when calling createInstance, but this message leads the user to believe otherwise. In this situation, nothing is actually wrong, but the message says "Cannot start optimizely".

To fix, in ProjectConfigManager __initialize, when config.datafile is falsy, we do not call __handleNewDatafile, avoiding the code path that eventually would log the error message.

Test plan

  • Added new unit test
  • Manually tested

@mjc1283 mjc1283 requested a review from a team as a code owner October 5, 2020 23:58
@mjc1283 mjc1283 removed their assignment Oct 5, 2020
@coveralls
Copy link

coveralls commented Oct 6, 2020

Coverage Status

Coverage increased (+0.003%) to 96.631% when pulling 8ffd5d9 on mcarroll/fix-error-when-not-initialized-with-datafile into f75c4fb on master.

Copy link
Contributor

@aliabbasrizvi aliabbasrizvi left a comment

Choose a reason for hiding this comment

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

LGTM

@mjc1283 mjc1283 merged commit 2817a4b into master Oct 6, 2020
@mjc1283 mjc1283 deleted the mcarroll/fix-error-when-not-initialized-with-datafile branch October 6, 2020 17:38
@mjc1283 mjc1283 linked an issue Oct 6, 2020 that may be closed by this pull request
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.

Suppress NO_DATAFILE_SPECIFIED error when sdkKey is present
3 participants