src/main/java/io/reactivex/Observable.java
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Observable<T> onErrorReturn(Function<? super Throwable, ? extends T> valueSupplier) {
        ObjectHelper.requireNonNull(valueSupplier, "valueSupplier is null");
        return RxJavaPlugins.onAssembly(new ObservableOnErrorReturn<T>(this, valueSupplier));
    }
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Observable<T> onErrorReturn(Function<? super Throwable, ? extends T> valueSupplier) {
        ObjectHelper.requireNonNull(valueSupplier, "valueSupplier is null");
        return RxJavaPlugins.onAssembly(new ObservableOnErrorReturn<T>(this, valueSupplier));
    }
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final Observable < T > onErrorReturn ( Function < ? super Throwable , ? extends T > valueSupplier ) { ObjectHelper . requireNonNull ( valueSupplier , "valueSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableOnErrorReturn < T > ( this , valueSupplier ) ) ; }
Instructs an ObservableSource to emit an item (returned by a specified function) rather than invoking
{@link Observer#onError onError} if it encounters an error.
<p>
<img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/onErrorReturn.o.png" alt="">
<p>
By default, when an ObservableSource encounters an error that prevents it from emitting the expected item to
its {@link Observer}, the ObservableSource invokes its Observer's {@code onError} method, and then quits
without invoking any more of its Observer's methods. The {@code onErrorReturn} method changes this
behavior. If you pass a function ({@code resumeFunction}) to an ObservableSource's {@code onErrorReturn}
method, if the original ObservableSource encounters an error, instead of invoking its Observer's
{@code onError} method, it will instead emit the return value of {@code resumeFunction}.
<p>
You can use this to prevent errors from propagating or to supply fallback data should errors be
encountered.
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code onErrorReturn} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param valueSupplier
a function that returns a single value that will be emitted along with a regular onComplete in case
the current Observable signals an onError event
@return the original ObservableSource with appropriately modified behavior
@see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
Instructs an ObservableSource to emit an item ( returned by a specified function ) rather than invoking { @link Observer#onError onError } if it encounters an error . <p > <img width = 640 height = 310 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / onErrorReturn . o . png alt = > <p > By default when an ObservableSource encounters an error that prevents it from emitting the expected item to its { @link Observer } the ObservableSource invokes its Observer s { @code onError } method and then quits without invoking any more of its Observer s methods . The { @code onErrorReturn } method changes this behavior . If you pass a function ( { @code resumeFunction } ) to an ObservableSource s { @code onErrorReturn } method if the original ObservableSource encounters an error instead of invoking its Observer s { @code onError } method it will instead emit the return value of { @code resumeFunction } . <p > You can use this to prevent errors from propagating or to supply fallback data should errors be encountered . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code onErrorReturn } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl >