rxAwait calls the uncaught exception handler
See original GitHub issueWhy 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("") }
Issue Analytics
- State:
- Created 6 years ago
- Comments:21 (18 by maintainers)
Top Results From Across the Web
java - Why is UncaughtExceptionHandler not called by ...
Because the exception does not go uncaught. The Thread that your ThreadFactory produces is not given your Runnable or Callable directly.
Read more >Thread.UncaughtExceptionHandler (Java Platform SE 7 )
Interface for handlers invoked when a Thread abruptly terminates due to an uncaught exception. When a thread is about to terminate due to...
Read more >Rx to Coroutines Concepts, Part 2.1: Exceptions
This means that any uncaught exception in any child coroutine terminates the whole coroutineScope. So say that you try and handle these ...
Read more >Coroutine exceptions handling | Kotlin
This section covers exception handling and cancellation on exceptions. We already know that a cancelled coroutine throws ...
Read more >Exceptions in coroutines. Cancellation and Exceptions in…
Handling exceptions properly has a huge impact on how users perceive your ... Uncaught exceptions will always be thrown regardless of the kind...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub 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.Hey everyone, any updates about this issue? We had the same problem described in this issue, we have fixed it using the
RxCoroutineExceptionHandler
in all therxSingle
/rxCompletable
invocation.Is this the best way to solve it? Should
RxCoroutineExceptionHandler
be included in the library as default exception handler for all the methods that transforms a suspending method into an rx object?