The onErrorResumeNext operator

The onErrorResumeNext operator helps you subscribe to a different producer in case any error occurs.

Here is an example:

    fun main(args: Array<String>) { 
      Observable.just(1,2,3,4,5) 
        .map { it/(3-it) } 
        .onErrorResumeNext(Observable.range(10,5))//(1) 
        .subscribe { 
           println("Received $it") 
        } 
   }

The output is as follows:

This operator is especially useful when you want to subscribe to another source producer in case any error occurs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.160.181