Make Throwable.printStackTrace() common

#KT-38044
This commit is contained in:
Ilya Gorbunov
2020-04-06 19:58:49 +03:00
parent 408b441a71
commit 38b1e6beab
3 changed files with 15 additions and 1 deletions
@@ -17,6 +17,14 @@ package kotlin
@SinceKotlin("1.4")
public actual fun Throwable.stackTraceToString(): String = ExceptionTraceBuilder().buildFor(this)
/**
* Prints the [detailed description][Throwable.stackTraceToString] of this throwable to console error output.
*/
@SinceKotlin("1.4")
public actual fun Throwable.printStackTrace() {
console.error(this.stackTraceToString())
}
/**
* Adds the specified exception to the list of exceptions that were
* suppressed in order to deliver this exception.