aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/ErrorUtil.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/util/ErrorUtil.kt')
-rw-r--r--src/main/kotlin/util/ErrorUtil.kt5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/kotlin/util/ErrorUtil.kt b/src/main/kotlin/util/ErrorUtil.kt
index 190381d..e82d369 100644
--- a/src/main/kotlin/util/ErrorUtil.kt
+++ b/src/main/kotlin/util/ErrorUtil.kt
@@ -38,6 +38,8 @@ object ErrorUtil {
}
class Catch<T> private constructor(val value: T?, val exc: Throwable?) {
+ fun orNull(): T? = value
+
inline fun or(block: (exc: Throwable) -> T): T {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
@@ -73,4 +75,7 @@ object ErrorUtil {
return nullable
}
+ fun softUserError(string: String) {
+ MC.sendChat(tr("frimanet.usererror", "Firmament encountered a user caused error: $string"))
+ }
}