Revert "Fix usingCancellable with null ret value"
This reverts commit d464d00067.
This commit is contained in:
1 parent
126f4238d6
commit
13b532c12a
2 files changed
+4
-5
No files matched your search
@@ -116,7 +116,7 @@ private fun rethrowExactly(code: Int, headers: Headers, body: String, e: Throwab
|
||||
throw e
|
||||
}
|
||||
|
||||
private suspend inline fun <T> Request.executeAndParsingWith(crossinline block: String.() -> T): T {
|
||||
private suspend inline fun <T> Request.executeAndParsingWith(block: String.() -> T): T {
|
||||
Log.d(TAG, url.toString())
|
||||
return execute {
|
||||
val body = body.string()
|
||||
|
||||
@@ -79,11 +79,10 @@ suspend inline fun <R> Call.usingCancellable(crossinline block: Response.() -> R
|
||||
r.exceptionOrNull()?.let {
|
||||
Log.e(TAG_CALL, "Reading response of call$call failed!")
|
||||
cont.resumeWithException(it)
|
||||
} ?: run {
|
||||
}
|
||||
r.getOrNull()?.let {
|
||||
Log.d(TAG_CALL, "Reading response of call$call succeed!")
|
||||
// R maybe null
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
cont.resume(r.getOrNull() as R)
|
||||
cont.resume(it)
|
||||
}
|
||||
} else if (isCanceled() && cont.isActive) {
|
||||
Log.e(TAG_CALL, "call$call cancelled but coroutine is Active!")
|
||||
|
||||
Reference in new issue
Block a user