From 3adc48e8a20b17faa793058de5d7dbe02fa92509 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Mon, 6 Jan 2025 03:10:10 +0100 Subject: [PATCH] Indent throwable message --- .../engine/base/utility/misc/StackTraceUtils.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/misc/StackTraceUtils.kt b/base/src/main/kotlin/de/staropensource/engine/base/utility/misc/StackTraceUtils.kt index c7b39ea..163c492 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/utility/misc/StackTraceUtils.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/utility/misc/StackTraceUtils.kt @@ -57,7 +57,12 @@ fun Any.methodCaller(depth: UInt = 1u): Origin { * @since v1-alpha10 */ fun Throwable.stacktraceHeader(): String { - return "Caused by: ${this.javaClass.name}${if (this.message == null) "" else ": ${this.message}"}" + if (message == null) + return "Caused by: ${this.javaClass.name}" + else { + val part0: String = "Caused by: ${this.javaClass.name}: " + return part0 + message!!.replace("\n", "\n${" ".repeat(part0.length)}") + } } /**