iex
02/13/2020, 7:26 AMonErrorReturn on the api observable(s) but this leads to a bit unwieldy chains in particular when there are several calls...Daniel Rodak
02/13/2020, 11:01 AMRxBindings library made by Jake Wharton which allows you to simply RxView.clicks(button)
Otherwise, if you don't want to add any external library you could write your own implementation of the clicks method which would based on the PublishSubject .
I'm not exactly sure how you should handle errors because it's based on the architecture that you are using. Personally, I'm using MVI and handling errors in the presenter/business layer.
Personally, I think that handling call by onErrorReturn is quite correct. You can add mapper for certain type of errors and then it's only a single method call inside error handler.
Also, wouldn't say that making a new subscribtion for each button press is a good practice.ursus
02/13/2020, 11:21 AMiex
02/14/2020, 11:56 AMonErrorReturn it means that you're creating a new subscription per click, since the observer chain is aborted.iex
02/14/2020, 11:57 AMiex
02/14/2020, 11:59 AMswitchMap to discard a possible ongoing request and cancelling the current subscription though.Daniel Rodak
02/14/2020, 12:30 PMdoOnErroriex
02/14/2020, 12:31 PMdoOnError doesn't do this afaik