diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-22 13:00:47 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-22 13:00:47 +0200 |
commit | 3e7aa9855489888283b6c53ce14002fe38d04dbe (patch) | |
tree | 9300e8176ac357f0c5637209196dd65f4c287d5c /src/main/java/at/hannibal2/skyhanni/events | |
parent | 47ac0f99f9d482c3ab3baf794d9ebf03fbee3d6b (diff) | |
download | skyhanni-3e7aa9855489888283b6c53ce14002fe38d04dbe.tar.gz skyhanni-3e7aa9855489888283b6c53ce14002fe38d04dbe.tar.bz2 skyhanni-3e7aa9855489888283b6c53ce14002fe38d04dbe.zip |
better error handling
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/events')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/events/RepositoryReloadEvent.kt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/events/RepositoryReloadEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RepositoryReloadEvent.kt index 5cfd59aa1..39d187326 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RepositoryReloadEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RepositoryReloadEvent.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.events import at.hannibal2.skyhanni.data.repo.RepoUtils +import at.hannibal2.skyhanni.test.command.CopyErrorCommand import com.google.gson.Gson import com.google.gson.JsonObject import java.io.File @@ -8,6 +9,10 @@ import java.io.File class RepositoryReloadEvent(val repoLocation: File, val gson: Gson): LorenzEvent() { fun getConstant(constant: String) = getConstant<JsonObject>(constant) - inline fun <reified T : Any> getConstant(constant: String) = + inline fun <reified T : Any> getConstant(constant: String) = try { RepoUtils.getConstant(repoLocation, constant, gson, T::class.java) + } catch (e: Exception) { + CopyErrorCommand.logError(Exception("Repo parsing error while trying to read constant '$constant'", e), "Error reading repo data") + null + } }
\ No newline at end of file |