admin管理员组文章数量:1402919
A srcObservable.retry() will catch the error emitted by the srcObservable and resubscribe to the srcObservable regardless of the type of the error. However, on certain scenario, it is wanted to only retry on certain type of error emitted by the srcObservable. Is there a way to do so in RxJs neatly?
A srcObservable.retry() will catch the error emitted by the srcObservable and resubscribe to the srcObservable regardless of the type of the error. However, on certain scenario, it is wanted to only retry on certain type of error emitted by the srcObservable. Is there a way to do so in RxJs neatly?
Share Improve this question edited Mar 19, 2015 at 17:12 Brandon 39.2k8 gold badges86 silver badges89 bronze badges asked Mar 19, 2015 at 0:34 victorxvictorx 3,5693 gold badges29 silver badges36 bronze badges1 Answer
Reset to default 10Try using retryWhen:
src.retryWhen(function (errors) {
// retry for some errors, end the stream with an error for others
return errors.do(function (e) {
if (!canRetry(e)) {
throw e;
}
});
});
本文标签: javascriptHow to retry only on certain error emitted by the source observable in RxJsStack Overflow
版权声明:本文标题:javascript - How to retry only on certain error emitted by the source observable in RxJs - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744356784a2602344.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论