<T> Observable<T> errorWhenLoggedIn(Throwable throwable) { if (throwable instanceof AuthException) { return userDataSource.getCurrentUser().flatMap(user -> Observable.error(throwable)); } else { return Observable.error(throwable); } }