File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
coroutines/src/main/java/com/parse/coroutines Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -15,21 +15,17 @@ import kotlin.coroutines.suspendCoroutine
1515suspend fun <T > Task<T>.suspendGet (dispatcher : CoroutineDispatcher = Dispatchers .IO ) = withContext<T >(dispatcher) {
1616 return @withContext suspendCoroutine { continuation ->
1717 waitForCompletion()
18- if (isFaulted) {
19- continuation.resumeWithException(error)
20- }
21- continuation.resume(result)
18+ if (isFaulted) continuation.resumeWithException(error)
19+ else continuation.resume(result)
2220 }
2321}
2422
2523@Suppress(" BlockingMethodInNonBlockingContext" )
2624suspend fun Task<Void>.suspendRun (dispatcher : CoroutineDispatcher = Dispatchers .IO ) = withContext<Unit >(dispatcher) {
2725 return @withContext suspendCoroutine { continuation ->
2826 waitForCompletion()
29- if (isFaulted) {
30- continuation.resumeWithException(error)
31- }
32- continuation.resume(Unit )
27+ if (isFaulted) continuation.resumeWithException(error)
28+ else continuation.resume(Unit )
3329 }
3430}
3531
You can’t perform that action at this time.
0 commit comments