1 /* 2 * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 package kotlinx.coroutines.rx2 6 7 import io.reactivex.functions.* 8 import io.reactivex.plugins.* 9 import kotlinx.coroutines.* 10 import kotlin.coroutines.* 11 12 internal class RxCancellable(private val job: Job) : Cancellable { cancelnull13 override fun cancel() { 14 job.cancel() 15 } 16 } 17 handleUndeliverableExceptionnull18internal fun handleUndeliverableException(cause: Throwable, context: CoroutineContext) { 19 if (cause is CancellationException) return // Async CE should be completely ignored 20 try { 21 RxJavaPlugins.onError(cause) 22 } catch (e: Throwable) { 23 handleCoroutineException(context, cause) 24 } 25 } 26