rxjava behaviour of onErrorResumeNext
<p>I am having trouble getting Observer.onErrorResumeNext to behave as i would expect.</p>

<pre><code>Subscriber orchestratorObserver = new Subscriber&lt;Integer&gt;() {
    @Override
    public void onCompleted() {
        System.out.println("orchestratorObserver."+"onCompleted()");
    }

    @Override
    public void onError(Throwable e) {
        System.out.println("orchestratorObserver."+"onError()"+e.getMessage());
    }

    @Override
    public void onNext(Integer i) {
        System.out.println("orchestratorObserver."+"onNext() : "+i);
    }
};

@Test
public void rxTest() {
    Observable.range(0,5)
            .doOnNext(new Action1&lt;Integer&gt;() {
                @Override
                public void call(Integer integer) {
                    throw new RuntimeException("chain error!!");
                }
            })
            .onErrorResumeNext(Observable.just(-1))
            .subscribe(orchestratorObserver);
}

@Test
public void rxTest1() {

    final Observable&lt;Integer&gt; errorTrainObservable = Observable.defer(
            new Func0&lt;Observable&lt;Integer&gt;&gt;() {
                @Override
                public Observable&lt;Integer&gt; call() {
                    return Observable.error(new RuntimeException("source error"));
                }
            });

    errorTrainObservable.onErrorResumeNext(Observable.just(-1));

    errorTrainObservable.subscribe(orchestratorObserver);
}
</code></pre>

<p>so rxTest() outputs:</p>

<pre><code>orchestratorObserver.onNext() : -1
orchestratorObserver.onCompleted()
</code></pre>

<p>while rxTest1() outputs:</p>

<pre><code>orchestratorObserver.onError()source error
</code></pre>

<p>I would like rxTest1 to output the same onNext event as rxTest - how can I do that? i.e. I want to swallow the error and emit a defualt value onNext event.</p>

<p>It seem odd that if the error is at the source it behaves one way - but if the error is the chain it behaves another way? Extra points if you can explain that to me :)</p>