Skip to content

Commit c548863

Browse files
committed
Throw exception if some configs was not loaded successfully. On first properties load exception will be propagated on higher layer but starting from second load exception will be only logged.
1 parent e1d0e6c commit c548863

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

config/src/main/java/io/scalecube/config/ConfigRegistryImpl.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -380,23 +380,21 @@ private void loadAndNotify() {
380380
for (String name : sources.keySet()) {
381381
ConfigSource source = sources.get(name);
382382

383-
Throwable loadException = null;
384-
Map<String, ConfigProperty> configMap = null;
383+
final Map<String, ConfigProperty> configMap;
385384
try {
386385
configMap = source.loadConfig();
387386
} catch (Exception e) {
388-
loadException = e; // save error occurrence
387+
computeConfigLoadStatus(name, source, e);
388+
throw e;
389389
}
390390

391-
computeConfigLoadStatus(name, source, loadException);
391+
computeConfigLoadStatus(name, source, null);
392392

393-
if (loadException == null) {
394-
// populate loaded properties with new field 'source'
395-
configMap.forEach(
396-
(key, configProperty) ->
397-
loadedPropertyMap.putIfAbsent(
398-
key, LoadedConfigProperty.withCopyFrom(configProperty).source(name).build()));
399-
}
393+
// populate loaded properties with new field 'source'
394+
configMap.forEach(
395+
(key, configProperty) ->
396+
loadedPropertyMap.putIfAbsent(
397+
key, LoadedConfigProperty.withCopyFrom(configProperty).source(name).build()));
400398
}
401399

402400
List<ConfigEvent> detectedChanges = new ArrayList<>();

0 commit comments

Comments
 (0)