Skip to content

Commit 3777437

Browse files
author
Rechee
committed
add top level CoroutineExceptionHandler
1 parent 8565923 commit 3777437

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

reactive/kotlinx-coroutines-rx2/src/RxScheduler.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ public fun CoroutineDispatcher.asScheduler(): Scheduler =
3636
private class DispatcherScheduler(internal val dispatcher: CoroutineDispatcher) : Scheduler() {
3737

3838
private val job = SupervisorJob()
39-
private val scope = CoroutineScope(job + dispatcher)
39+
private val scope = CoroutineScope(job + dispatcher + CoroutineExceptionHandler { _, throwable ->
40+
RxJavaPlugins.onError(throwable)
41+
})
4042

4143
override fun scheduleDirect(block: Runnable): Disposable =
4244
scheduleDirect(block, 0, TimeUnit.MILLISECONDS)
@@ -136,10 +138,8 @@ public class SchedulerCoroutineDispatcher(
136138

137139
/** @suppress */
138140
override fun toString(): String = scheduler.toString()
139-
140141
/** @suppress */
141142
override fun equals(other: Any?): Boolean = other is SchedulerCoroutineDispatcher && other.scheduler === scheduler
142-
143143
/** @suppress */
144144
override fun hashCode(): Int = System.identityHashCode(scheduler)
145145
}

0 commit comments

Comments
 (0)