Skip to content

Commit 2c1f2fb

Browse files
committed
Prevent huge error when no config was saved yet
1 parent cc49913 commit 2c1f2fb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

common/src/main/kotlin/com/lambda/config/Configuration.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ abstract class Configuration : Jsonable {
104104
}
105105

106106
private fun load(file: File) {
107-
check(file.exists()) { "No configuration file found for ${configName.capitalize()}" }
107+
if (!file.exists()) {
108+
LOG.warn("No configuration file found for ${configName.capitalize()}. Creating new file when saving.")
109+
return
110+
}
108111

109112
loadFromJson(JsonParser.parseReader(file.reader()).asJsonObject)
110113
}

0 commit comments

Comments
 (0)