aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/ErrorUtil.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-10-13 17:32:10 +0200
committerLinnea Gräf <nea@nea.moe>2024-10-13 17:32:10 +0200
commite6142bb93619dee768fc18b87ffdd28558d4bcab (patch)
tree03df79712151f7579cd683c8340741ebb3191822 /src/main/kotlin/util/ErrorUtil.kt
parentdaa63bd914a2f6c5e9b668abb8474884685ee818 (diff)
downloadFirmament-e6142bb93619dee768fc18b87ffdd28558d4bcab.tar.gz
Firmament-e6142bb93619dee768fc18b87ffdd28558d4bcab.tar.bz2
Firmament-e6142bb93619dee768fc18b87ffdd28558d4bcab.zip
Make pickaxe ability display use AbilityUtils
[no changelog]
Diffstat (limited to 'src/main/kotlin/util/ErrorUtil.kt')
-rw-r--r--src/main/kotlin/util/ErrorUtil.kt16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/kotlin/util/ErrorUtil.kt b/src/main/kotlin/util/ErrorUtil.kt
new file mode 100644
index 0000000..4f229af
--- /dev/null
+++ b/src/main/kotlin/util/ErrorUtil.kt
@@ -0,0 +1,16 @@
+package moe.nea.firmament.util
+
+import moe.nea.firmament.Firmament
+
+object ErrorUtil {
+ var aggressiveErrors = run {
+ Thread.currentThread().stackTrace.any { it.className.startsWith("org.junit.") } || Firmament.DEBUG
+ }
+
+ @Suppress("NOTHING_TO_INLINE") // Suppressed since i want the logger to not pick up the ErrorUtil stack-frame
+ inline fun softError(message: String) {
+ if (aggressiveErrors) error(message)
+ else Firmament.logger.error(message)
+ }
+
+}