src/main/java/io/reactivex/Single.java
@CheckReturnValue
    @NonNull
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Single<T> onErrorReturn(final Function<Throwable, ? extends T> resumeFunction) {
        ObjectHelper.requireNonNull(resumeFunction, "resumeFunction is null");
        return RxJavaPlugins.onAssembly(new SingleOnErrorReturn<T>(this, resumeFunction, null));
    }
@CheckReturnValue
    @NonNull
    @SchedulerSupport(SchedulerSupport.NONE)
    public final Single<T> onErrorReturn(final Function<Throwable, ? extends T> resumeFunction) {
        ObjectHelper.requireNonNull(resumeFunction, "resumeFunction is null");
        return RxJavaPlugins.onAssembly(new SingleOnErrorReturn<T>(this, resumeFunction, null));
    }
@ CheckReturnValue @ NonNull @ SchedulerSupport ( SchedulerSupport . NONE ) public final Single < T > onErrorReturn ( final Function < Throwable , ? extends T > resumeFunction ) { ObjectHelper . requireNonNull ( resumeFunction , "resumeFunction is null" ) ; return RxJavaPlugins . onAssembly ( new SingleOnErrorReturn < T > ( this , resumeFunction , null ) ) ; }
Instructs a Single to emit an item (returned by a specified function) rather than invoking
{@link SingleObserver#onError onError} if it encounters an error.
<p>
<img width="640" height="451" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.onErrorReturn.png" alt="">
<p>
By default, when a Single encounters an error that prevents it from emitting the expected item to its
subscriber, the Single invokes its subscriber's {@link SingleObserver#onError} method, and then quits
without invoking any more of its subscriber's methods. The {@code onErrorReturn} method changes this
behavior. If you pass a function ({@code resumeFunction}) to a Single's {@code onErrorReturn} method, if
the original Single encounters an error, instead of invoking its subscriber's
{@link SingleObserver#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 resumeFunction
a function that returns an item that the new Single will emit if the source Single encounters
an error
@return the original Single with appropriately modified behavior
@see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
Instructs a Single to emit an item ( returned by a specified function ) rather than invoking { @link SingleObserver#onError onError } if it encounters an error . <p > <img width = 640 height = 451 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / Single . onErrorReturn . png alt = > <p > By default when a Single encounters an error that prevents it from emitting the expected item to its subscriber the Single invokes its subscriber s { @link SingleObserver#onError } method and then quits without invoking any more of its subscriber s methods . The { @code onErrorReturn } method changes this behavior . If you pass a function ( { @code resumeFunction } ) to a Single s { @code onErrorReturn } method if the original Single encounters an error instead of invoking its subscriber s { @link SingleObserver#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 >