How to ignore error and continue infinite stream?

后端 未结 10 1770
执念已碎
执念已碎 2020-12-05 06:18

I would like to know how to ignore exceptions and continue infinite stream (in my case stream of locations)?

I\'m fetching current user position (using Android-React

10条回答
  •  广开言路
    2020-12-05 06:46

    If you just want to ignore the error inside the flatMap without returning an element do this:

    flatMap(item -> 
        restService.getSomething(item).onErrorResumeNext(Observable.empty())
    );
    

提交回复
热议问题