tools for error reporting in kotlin

This commit is contained in:
sergeych committed 2026-01-07 18:12:14 +01:00
1 parent eda34c1b3d
commit 2ce6d8e482
2 files changed
+36 -1

No files matched your search

@@ -89,6 +89,17 @@ open class ObjException(
override val objClass: ObjClass = exceptionClass
/**
* Tool to get kotlin string with error report including the Lyng stack trace.
*/
suspend fun toStringWithStackTrace(): String {
val l = getStackTrace().list
return buildString {
append(message.value)
for( t in l)
append("\n\tat ${t.toString(scope)}")
}
}
override suspend fun defaultToString(scope: Scope): ObjString {
val at = getStackTrace().list.firstOrNull()?.toString(scope)
?: ObjString("(unknown)")