So I have these two parallel calls using zip operator. I am making two network calls. I have the following questions:
- How can I handle the individual errors correctly
- If the first call fails I want to be able to exit the session but if the second network call fails I want to allow the user to still go through the session. I am seeing a 404 in my second network call in the zip and the entire chain fails with an error. I want it to be able to handle success and failure
valid session response 1: success response 2: failure
invalid session response 1: failure response 2: success
invalid session both endpoints fail
Single.zip(
api1.getData().doOnError {
// handle error : exit right away
},
api2.getData().doOnError {
// handle error: Set profile data to be empty but when user tries to see the profile information show error at a later point in time based oaths response
// got 404
},
{ response1: String, response2: CustomObject ->
Pair(response1, response2)
}
)
.subscribeOn(Schedulers.io())
.subscribe(
{
handleResponse1(it.first)
handleRespone2(it.second)
},
{
Timber.d("it : $it")
// api1 use success response: is it even possibel to get that in the iterator
// api 2 throwing 404 here
}
)