iex
03/25/2020, 1:55 PMCan't error out
I'd like that e.g. if I map a click button trigger to an api request an the api request fails, it executes again the next time the trigger is activated. Without having to create a new subscription each time.magnumrocha
03/25/2020, 2:04 PMmagnumrocha
03/25/2020, 2:05 PMonErrorReturn onErrorReturnItempt
03/25/2020, 10:04 PMRxRelay might be what you wantiex
03/26/2020, 6:10 AMonErrorReturn and onErrorReturnItem still cancel the streamiex
03/26/2020, 6:11 AMiex
03/26/2020, 6:12 AMSingle to a Result or something... it's just not as convenient as Driveriex
03/26/2020, 6:13 AMDriver is like LiveData, but it recovers from errorsmagnumrocha
03/26/2020, 8:24 AMflatMap (in case of Single) or `switchMap`:
disposable = reactiveLocationProvider.getUpdatedLocation(mLocationRequest)
.buffer(50)
.flatMap(locations -> mRestService.postLocations(locations).onErrorReturn { e -> emptyList() }
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe()iex
03/26/2020, 8:32 AMiex
03/26/2020, 8:33 AMiex
03/26/2020, 8:34 AMempty() or similariex
03/26/2020, 8:35 AMmagnumrocha
03/26/2020, 8:36 AMiex
03/27/2020, 1:50 PM