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
15
15
suspend fun <T > Task<T>.suspendGet (dispatcher : CoroutineDispatcher = Dispatchers .IO ) = withContext<T >(dispatcher) {
16
16
return @withContext suspendCoroutine { continuation ->
17
17
waitForCompletion()
18
- if (isFaulted) {
19
- continuation.resumeWithException(error)
20
- }
21
- continuation.resume(result)
18
+ if (isFaulted) continuation.resumeWithException(error)
19
+ else continuation.resume(result)
22
20
}
23
21
}
24
22
25
23
@Suppress(" BlockingMethodInNonBlockingContext" )
26
24
suspend fun Task<Void>.suspendRun (dispatcher : CoroutineDispatcher = Dispatchers .IO ) = withContext<Unit >(dispatcher) {
27
25
return @withContext suspendCoroutine { continuation ->
28
26
waitForCompletion()
29
- if (isFaulted) {
30
- continuation.resumeWithException(error)
31
- }
32
- continuation.resume(Unit )
27
+ if (isFaulted) continuation.resumeWithException(error)
28
+ else continuation.resume(Unit )
33
29
}
34
30
}
35
31
You can’t perform that action at this time.
0 commit comments