Handling Multiple Errors

[Solved] Handling Multiple Errors | Vb - Code Explorer | yomemimo.com
Question : Handling multiple errors

Answered by : deepika-sahu

What will happen (in terms of error handling) if getAllUsers() emits a sequence of 10 userIds and getUserProfile(userId) emits error for every userId?
Is the behaviour different between RxJava1 and RxJava2?
getAllUsers() .flatMap(userId -> getUserProfile(userId).subscribeOn(Schedulers.io())) .onErrorResumeNext(...) .subscribe(...)
In RxJava1 the first propagated error will terminate the stream.
All other started parallel streams (that’ll error out as well) are the so-called “undelivered exceptions”, which are just “swallowed” (printed in console by default).
Difference with RxJava2 comes from the handling of these undeliverable exceptions – they’ll be sent to a global error handler (set via RxJavaPlugins.setErrorHandler()), where further handing can occur.
If such error handler isn’t set, the exceptions are propagated upstream to the calling thread (e.g. will cause a crash of the app).

Source : | Last Update : Thu, 05 Jan 23

Answers related to handling multiple errors

Code Explorer Popular Question For Vb