kotlinx.coroutines: rxAwait calls the uncaught exception handler

Why does the following code calls the uncaught exception handler?

As there is an onError supplied I expect it to be called instead.

import io.reactivex.Observable
import io.reactivex.Single
import kotlinx.coroutines.experimental.rx2.await
import kotlinx.coroutines.experimental.rx2.rxSingle
import java.io.IOException
import java.util.concurrent.TimeUnit

fun main(args: Array<String>) {
  Observable
    .interval(1, TimeUnit.MILLISECONDS)
    .switchMapSingle {
      rxSingle {
        timeBomb().await()
      }
    }
    .subscribe({}, {})

  Thread.sleep(1000)
}

private fun timeBomb() = Single.timer(1, TimeUnit.MILLISECONDS)
  .doOnSuccess { throw IOException("") }

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 21 (18 by maintainers)

Commits related to this issue

Most upvoted comments

@fabioCollini yes, I’ve made the fix for 1.3.3. The current solution is to report undeliverable exceptions to RxJavaPlugins, so @jcornaz example without coroutines and original one work similarly.