Commit cd0db1c7 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Throw exception when the config files are empty.

parent 1d6f483d
......@@ -40,7 +40,11 @@ class YamlLoader(private val directory: String) {
LoadSettings.builder().setAllowDuplicateKeys(true).setEnvConfig(Optional.of(CustomEnvConfig())).build()
val load = Load(settings)
return try {
load.loadAllFromString(readFiles()) as Iterable<Any>
val data = readFiles()
if (data.isEmpty()) {
throw InvalidMappingException("The mapping file may not be empty!")
}
load.loadAllFromString(data) as Iterable<Any>
} catch (ex: MissingEnvironmentVariableException) {
throw MissingSettingException("env", ex.localizedMessage)
} catch (ex: ClassCastException) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment