RxJava2 UndeliverableException when orientation change is happening while fetching data

You can override Rx Error Handler with following way:

  1. Extends Application class with your custom MyApplication.
  2. Then write this in onCreate method of your application class:

    @Override
    public void onCreate() {
        super.onCreate();
        RxJavaPlugins.setErrorHandler(throwable -> {}); // nothing or some logging
    }
    
  3. Add MyApplication class to Manifest:

    <application
        android:name=".MyApplication"
        ...>
    

For more information, please take a look at RxJava Wiki


For catch this kind of errors that may raise by 3rd pary library or your own code use RxJavaPlugins and in the fun or ... that you used Rx write this code and tha uncatched rx error will be delivered to this code, so must check the exception type:

RxJavaPlugins.setErrorHandler {
        if( it is  UndeliverableException){
            Toast.makeText(view?.getContext(), "UndeliverableException: " + it.message, Toast.LENGTH_LONG).show()
            return@setErrorHandler
        }
    }

for the reference check this link: enter link description here