diff options
author | Linnea Gräf <nea@nea.moe> | 2025-06-20 15:49:15 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-06-20 15:49:15 +0200 |
commit | 286691c54c87b5e2e70eef7b51469b4ade5a75f6 (patch) | |
tree | a4812f2afe10d836b5682c5c957abcff674db676 /src/main/kotlin/util/ErrorUtil.kt | |
parent | 54a76553a7ebda48f223b7a005466345e3c4774d (diff) | |
download | Firmament-286691c54c87b5e2e70eef7b51469b4ade5a75f6.tar.gz Firmament-286691c54c87b5e2e70eef7b51469b4ade5a75f6.tar.bz2 Firmament-286691c54c87b5e2e70eef7b51469b4ade5a75f6.zip |
feat: Add screen layout replacement feature for texture packs
Diffstat (limited to 'src/main/kotlin/util/ErrorUtil.kt')
-rw-r--r-- | src/main/kotlin/util/ErrorUtil.kt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/kotlin/util/ErrorUtil.kt b/src/main/kotlin/util/ErrorUtil.kt index 2f0acd6..f12bb12 100644 --- a/src/main/kotlin/util/ErrorUtil.kt +++ b/src/main/kotlin/util/ErrorUtil.kt @@ -37,6 +37,13 @@ object ErrorUtil { else Firmament.logger.error(message) } + fun <T> Result<T>.intoCatch(message: String): Catch<T> { + return this.map { Catch.succeed(it) }.getOrElse { + softError(message, it) + Catch.fail(it) + } + } + class Catch<T> private constructor(val value: T?, val exc: Throwable?) { fun orNull(): T? = value |