Indent throwable message

This commit is contained in:
JeremyStar™ 2025-01-06 03:10:10 +01:00
parent 59c9e7b156
commit 3adc48e8a2
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -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)}")
}
}
/**