aboutsummaryrefslogtreecommitdiff
path: root/reactive/kotlinx-coroutines-rx2/src/RxCancellable.kt
diff options
context:
space:
mode:
Diffstat (limited to 'reactive/kotlinx-coroutines-rx2/src/RxCancellable.kt')
-rw-r--r--reactive/kotlinx-coroutines-rx2/src/RxCancellable.kt11
1 files changed, 11 insertions, 0 deletions
diff --git a/reactive/kotlinx-coroutines-rx2/src/RxCancellable.kt b/reactive/kotlinx-coroutines-rx2/src/RxCancellable.kt
index d76f1231..a0c32f9f 100644
--- a/reactive/kotlinx-coroutines-rx2/src/RxCancellable.kt
+++ b/reactive/kotlinx-coroutines-rx2/src/RxCancellable.kt
@@ -5,10 +5,21 @@
package kotlinx.coroutines.rx2
import io.reactivex.functions.*
+import io.reactivex.plugins.*
import kotlinx.coroutines.*
+import kotlin.coroutines.*
internal class RxCancellable(private val job: Job) : Cancellable {
override fun cancel() {
job.cancel()
}
+}
+
+internal fun handleUndeliverableException(cause: Throwable, context: CoroutineContext) {
+ if (cause is CancellationException) return // Async CE should be completely ignored
+ try {
+ RxJavaPlugins.onError(cause)
+ } catch (e: Throwable) {
+ handleCoroutineException(context, cause)
+ }
} \ No newline at end of file