When we want to handle error observable in RxJS v6+, we can use 'retryWhen' and 'delayWhen':

const courses$: Observable<Counse[]> = http$
.pipe(
tap(() => console.log("HTTP request")),
map(res => Object.values(res['payload'])),
shareReplay(), // avoid using async pipe multi times causing multi network request
retryWhen(errors => errors.pipe(
delayWhen(() => timer(2000)) // wait 2s after the error observable happens
))
)

[RxJS 6] The Retry RxJs Error Handling Strategy的更多相关文章

  1. [RxJS 6] The Catch and Rethrow RxJs Error Handling Strategy and the finalize Operator

    Sometime we want to set a default or fallback value when network request failed. http$ .pipe( map(re ...

  2. [RxJS] Error handling operator: catch

    Most of the common RxJS operators are about transformation, combination or filtering, but this lesso ...

  3. beam 的异常处理 Error Handling Elements in Apache Beam Pipelines

    Error Handling Elements in Apache Beam Pipelines Vallery LanceyFollow Mar 15 I have noticed a defici ...

  4. 转 InnoDB Error Handling

    14.20.4 InnoDB Error Handling Error handling in InnoDB is not always the same as specified in the SQ ...

  5. 19 Error handling and Go go语言错误处理

    Error handling and Go go语言错误处理 12 July 2011 Introduction If you have written any Go code you have pr ...

  6. Erlang error handling

    Erlang error handling Contents Preface try-catch Process link Erlang-way error handling OTP supervis ...

  7. MySQL Error Handling in Stored Procedures 2

    Summary: this tutorial shows you how to use MySQL handler to handle exceptions or errors encountered ...

  8. setjmp()、longjmp() Linux Exception Handling/Error Handling、no-local goto

    目录 . 应用场景 . Use Case Code Analysis . 和setjmp.longjmp有关的glibc and eglibc 2.5, 2.7, 2.13 - Buffer Over ...

  9. Error Handling

    Use Exceptions Rather Than Return Codes Back in the distant past there were many languages that didn ...

随机推荐

  1. Java初级面试模拟1

    1.简单介绍一下你的项目,说一下项目有什么模块 2.说说常见的集合有哪些吧 答:Map接口和Collection接口是所有集合框架的父接口: Collection接口的子接口包括:Set接口和List ...

  2. Linux 下 Solr的搭建与使用(建议jdk1.8以上)

    官方表示solr5之后的版本不再提供对第三方容器的支持(不提供war包了). “旧式”solr.xml格式不再支持,核心必须使用core.properties文件定义. 使用第三方容器的需要自己手动修 ...

  3. HTML--使用提交按钮,提交数据

    在表单中有两种按钮可以使用,分别为:提交按钮.重置.这一小节讲解提交按钮:当用户需要提交表单信息到服务器时,需要用到提交按钮. 语法: <input type="submit" ...

  4. day01_12/11/2016_Spring入门PPT

    s1 s2 s3 s4 s5 s6 s7 s8 IOC1 IOC2 入门编写1 入门编写2 入门编写3 入门编写4---心得

  5. [转]Android自定义Adapter的ListView的思路及代码

    本文转自:http://www.jb51.net/article/37236.htm 在开发中,我们经常使用到ListView这个控件.Android的API也提供了许多创建ListView适配器的快 ...

  6. C# 利用反射进行类型转换

    /// <summary> /// 父类转子类 /// </summary> /// <typeparam name="TParent">< ...

  7. vue-cli 打包优化

    1. 优化打包体积 先上2个图 (上图A是优化前的各个js大小对比视图,下图B是优化后,还未完全优化完成的,不过也可以看得出来对比) 图A是3个压缩文件,包括部分图片和使用的所有js,体积都偏大 图B ...

  8. GridView中的日期处理

    数字 {0:N2} 12.36  数字 {0:N0} 13  货币 {0:c2} $12.36  货币 {0:c4} $12.3656  货币  "¥{0:N2}"  ¥12.36 ...

  9. 【centOS7】Jenkins安装--漫漫踩坑路

    安装步骤: https://www.cnblogs.com/h--d/p/5673085.html 安装后遇到的问题及解决办法: jenkins的admin用户的初始密码路径 https://blog ...

  10. 1 JSONP

    一.什么是跨域访问举个栗子:在A网站中,我们希望使用Ajax来获得B网站中的特定内容.如果A网站与B网站不在同一个域中,那么就出现了跨域访问问题.你可以理解为两个域名之间不能跨过域名来发送请求或者请求 ...