androidx icon indicating copy to clipboard operation
androidx copied to clipboard

Have RxPagedListBuilder emit errors in RxJava chain

Open veyndan opened this issue 2 years ago • 4 comments

Proposed Changes

From https://issuetracker.google.com/issues/233703110:

In Paging 2.1.2, when an error is thrown from the DataSource.Factory, the error is propagated through the rx chain, so we could use things like onErrorResumeNext(…) when there's an error so we can fail safely. In Paging 3, this error is no longer propagated through the rx chain, so our callback in onErrorResumeNext(…) is never invoked.

I've just wrapped the invalidate job contents with a try-catch. This is a greatly simplified version of what rxObservable does.

Note: the diff in GitHub looks like many things changed in RxPagedListBuilder, but checking out the diff in Android Studio shows that I did in fact just wrap it all in a try-catch.

Testing

Test: ./gradlew paging:paging-rxjava2:test paging:paging-rxjava2:test

Issues Fixed

Fixes: 233703110

veyndan avatar Jun 20 '22 12:06 veyndan

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Jun 20 '22 12:06 google-cla[bot]

Hi, thanks for the PR. Would you be able to update the original bug https://issuetracker.google.com/issues/233703110 with a sample project so we can repro your use case? It would help us evaluate whether it is a bug and how we might resolve it.

Closing this PR in the meantime but we'll keep an eye on the bug for when you update it. Thank you.

claraf3 avatar Jun 27 '22 22:06 claraf3

Hi @claraf3,

In https://issuetracker.google.com/issues/233703110#comment1 I'd already linked a failing test which showcases the problem. The link is to this file, mainly because the only substantive changes in the repo is that file, but you should be able to clone https://github.com/veyndan/androidx-paging-2-to-3-regressions and run the tests locally. By toggling between Paging 2 (e.g., v2.1.2) and Paging 3 (e.g., v3.1) in the build.gradle.kts file, you'll be able to see that the tests pass when using Paging 2, but fail when using Paging 3.

Please let me know if there were troubles recreating the issue on your end.

veyndan avatar Jun 28 '22 08:06 veyndan

Hey @claraf3, is there anything else that I can do to move this along?

veyndan avatar Jul 12 '22 15:07 veyndan