Error-handling Operators
Learn about error-handling operators and their utilization.
Delivering errors
As we’ve seen, when an error is encountered in a stream, RxJava delivers the error to the Observer
via .onError()
. Given that .onError()
is terminal, no further processing will occur. However, this can be problematic, as programmer Dan Lew explains in his blog post:
Error Handling in RxJava
"I want to clear up something that many RxJava beginners get wrong:
onError
is an extreme event that should be reserved for times when sequences cannot continue. It means that there was a problem in processing the current item such that no future processing of any items can occur.It’s the Rx version of
try-catch
: it skips all code between ...