Last active
March 2, 2016 18:46
-
-
Save murki/3528dcb43a525aaf6a83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DomainService.java | |
@RxLogObservable | |
public Observable<Data> getData() { | |
return getMergedData() | |
.onErrorReturn(new Func1<Throwable, Data>() { | |
@Override | |
public Data call(Throwable throwable) { | |
Log.e(CLASSNAME, "Error while fetching data. Swallowing the exception.", throwable); | |
return null; // We return null since we know our filter will ignore null values. | |
} | |
}) | |
.filter( | |
new Func1<Data, Boolean>() { | |
@Override | |
public Boolean call(Data data) { | |
return data != null; | |
} | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment