What is the easiest way to convert the result of Throwable.getStackTrace() to a string that depicts the stacktrace?
Throwable.getStackTrace()
Extending the Throwable class will give you the String property error.stackTraceString:
error.stackTraceString
val Throwable.stackTraceString: String get() { val sw = StringWriter() val pw = PrintWriter(sw) this.printStackTrace(pw) return sw.toString() }