Call.await(): copy exception message when preserving error stack (#9013)

(cherry picked from commit 7559c133c05cff0a41d11757ec31c86da7bf5c74)
This commit is contained in:
stevenyomi 2023-02-02 00:09:35 +08:00 committed by Jobobby04
parent fb937d9ad6
commit c3c52badca

View File

@ -78,7 +78,7 @@ private suspend fun Call.await(callStack: Array<StackTraceElement>): Response {
override fun onFailure(call: Call, e: IOException) {
// Don't bother with resuming the continuation if it is already cancelled.
if (continuation.isCancelled) return
val exception = IOException(e).apply { stackTrace = callStack }
val exception = IOException(e.message, e).apply { stackTrace = callStack }
continuation.resumeWithException(exception)
}
}