Skip to content

Commit 0699fad

Browse files
Improve exception message for invalid fallback config (#1424)
* Add specific error message * Extend message
1 parent e154442 commit 0699fad

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

inspectit-ocelot-core/src/main/java/rocks/inspectit/ocelot/core/config/InspectitEnvironment.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@ protected void configurePropertySources(Optional<String> cmdLineArgs) {
211211
currentSources.forEach(ps -> propsList.remove(ps.getName()));
212212
fallbackSources.forEach(ps -> propsList.addLast(ps));
213213

214-
currentConfig = loadAndValidateFromProperties(INSPECTIT_ROOT_PREFIX, InspectitConfig.class).get();
214+
Optional<InspectitConfig> fallbackConfig = loadAndValidateFromProperties(INSPECTIT_ROOT_PREFIX, InspectitConfig.class);
215+
if (fallbackConfig.isPresent()) {
216+
currentConfig = fallbackConfig.get();
217+
} else {
218+
throw new RuntimeException("The fallback configuration could not be parsed, probably due to a validation error. See logs for further information.");
219+
}
215220

216221
fallbackSources.forEach(ps -> propsList.remove(ps.getName()));
217222
currentSources.forEach(ps -> propsList.addLast(ps));

0 commit comments

Comments
 (0)