mirror of
https://github.com/mihonapp/mihon.git
synced 2025-07-01 13:37:50 +02:00
Preserve async stack traces of http requests
This commit is contained in:
@ -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
|
||||
}
|
Reference in New Issue
Block a user