Preserve async stack traces of http requests

This commit is contained in:
NerdNumber9
2019-04-14 00:27:44 -04:00
parent 8119eb4b34
commit 8a70dffae8
2 changed files with 18 additions and 0 deletions

View File

@ -4,4 +4,14 @@ inline fun <T> ignore(expr: () -> T): T? {
return try { expr() } catch (t: Throwable) { null }
}
fun <T : Throwable> T.withRootCause(cause: Throwable): T {
val curCause = this.cause
if(curCause == null) {
this.initCause(cause)
} else {
curCause.withRootCause(cause)
}
return this
}