Commit 2817a4b
authored
fix(project config manager): Don't log an error when not initialized with datafile (#589)
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 tested1 parent f75c4fb commit 2817a4b
File tree
3 files changed
+15
-2
lines changed- packages/optimizely-sdk
- lib/core/project_config
3 files changed
+15
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
96 | 101 | | |
97 | 102 | | |
98 | 103 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
350 | 357 | | |
351 | 358 | | |
352 | 359 | | |
| |||
0 commit comments