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 PMonErrorReturn
onErrorReturnItem
pt
03/25/2020, 10:04 PMRxRelay
might be what you wantiex
03/26/2020, 6:10 AMonErrorReturn
and onErrorReturnItem
still cancel the streamSingle
to a Result
or something... it's just not as convenient as Driver
Driver
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 AMempty()
or similarmagnumrocha
03/26/2020, 8:36 AMiex
03/27/2020, 1:50 PM