These are chat archives for ReactiveX/RxJava

16th
Jun 2015
Matt Langston
@mattblang
Jun 16 2015 19:03
I’ve got an interesting situation I haven’t come across yet. I do several REST calls to register a user, log them in automatically, grab their profile, etc. I’m flat mapping all of these REST calls together. In my subscriber I handle a Throwable. The tricky part is, I need to be able to do something different depending on if they error during registration or after, because if the registration is successful but the auto login / profile fetch is not I don’t want them to try to log in again. Any hints?
Andrew Reitz
@pieces029
Jun 16 2015 19:10
@mattblang can you use doOnError after the call you want to specifically handle? Otherwise instance of in the onError, but that sounds gross.
Matt Langston
@mattblang
Jun 16 2015 19:11
@pieces029 I can doOnError from the first flatMap, sure, but will that stop the chain of flatMaps?
Matt Langston
@mattblang
Jun 16 2015 19:26
@pieces029 Yeah, so the doOnError hits but the onError in my subscriber still picks up the error as well. If I could somehow intercept the throwable and rethrow my own custom one maybe...
Matt Langston
@mattblang
Jun 16 2015 19:53
@pieces029 Okay, so I think I got it. Just do a doOnError for each step of the flatMap, rather than having an onError subscriber function
Diego Magalhães
@dgomesbr
Jun 16 2015 20:14
Could you use an either with left and right like in Scala? Do we have that in rx?
Andrew Reitz
@pieces029
Jun 16 2015 20:32
nice