The errors which have been emitted but cannot be swallowed can be routed to RxJavaPlugins.onError handler. RxJavaPlugins is a registry for plugin implementation which facilitates global override and handles the retrieval of correct implementation. The RxJavaPlugins.onError handles the emitted errors which have not been swallowed yet. By default, the onError prints the stack trace of the Throwable on the console and then calls the exception handler on the current thread for the uncaught exception.
Oops!! Too many things are happening. Let's first of all check what happens when we use the RxJavaPlugins.onError, as shown by the code written in onError() method as follows:
public class Demo_RxJava2 { public static void main(String[] args) { Observable<Integer> observable = Observable.just(12, 30, 5, 50, 89); ...