O'Reilly logo

Reactive Android Programming by Tadas Subonis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

onErrorReturn

.onErrorReturn() work in a similar fashion to .onErrorResumeNext(), but instead of using Observable to resume the flow, it takes the value unwrapped from the Observable. Consider the following example:

Observable.<String>error(new Error("Crash!"))        .onErrorReturn(throwable -> "Return")        .subscribe(item -> {            log("subscribe", item);        }, e -> log("subscribe", e));

We can see that we didn't need to wrap "Return" in the Observable class of any kind.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required