Skip to content

Commit

Permalink
Fixed KAGA crashing on start
Browse files Browse the repository at this point in the history
  • Loading branch information
waicool20 committed Jan 22, 2017
1 parent a21f5d6 commit bab18c1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main/kotlin/com/waicool20/kaga/config/KagaConfig.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.waicool20.kaga.config

import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.databind.JsonMappingException
import com.fasterxml.jackson.databind.ObjectMapper
import com.waicool20.kaga.Kaga
import org.slf4j.LoggerFactory
Expand All @@ -26,11 +27,17 @@ data class KagaConfig(var currentProfile: String = "",
Files.createDirectories(path.parent)
Files.createFile(path)
}
with (ObjectMapper().readValue(Kaga.CONFIG_FILE.toFile(), KagaConfig::class.java)) {
loaderLogger.info("Loading KAGA configuration was successful")
loaderLogger.debug("Loaded $this")
return this
try {
with (ObjectMapper().readValue(Kaga.CONFIG_FILE.toFile(), KagaConfig::class.java)) {
loaderLogger.info("Loading KAGA configuration was successful")
loaderLogger.debug("Loaded $this")
return this
}
} catch (e: JsonMappingException) {
loaderLogger.warn("No valid Json configuration was found, error: ${e.message}")
}
loaderLogger.info("Using a default configuration")
return KagaConfig()
}
}

Expand Down

0 comments on commit bab18c1

Please sign in to comment.