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. PHP流程控制语句(if,foreach,break......)

    背景:PHP程序中,必不可少的要用到流程控制语句.这次对于流程控制语句进行一些总结. 条件控制语句和循环控制语句是两种基本的语法结构,它们都是用来控制程序执行流程.也是构成程序的主要语法基础. 一.程 ...

  2. Android RecyclerView利用Glide加载大量图片into(Target)导致OOM异常

    学过android的人应该都知道Glide是一个无比强大的图片加载库,它内部已经提供了很好的缓存机制供我们选择,我们只需一个参数调用即可(DiskCacheStrategy()),而不必像Univer ...

  3. 利用php生成验证码

    <?php /** * php生成验证码 * @param $width 画布宽 * @param $height 画布高 * @param $vcodelen 验证码长度 * @param $ ...

  4. C 语言常用方法技巧

    C语言常用方法技巧 *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !impor ...

  5. Discuz 取消 应用更新提醒 方法

    管理员每次登录论坛,遇有后台没有更新的应用都会有应用更新提醒提醒,而且关了还会继续弹出,问题是有些应用原来我装了免费的,新版本推出来了是 要收费的,我不想要更新,或者是即使有免费的新版本了,而我只要使 ...

  6. C# null

    var t0est = Convert.ToString(""+null);//结果"" var t1est = ("" + null).T ...

  7. SpringMVC知识点总结一(非注解方式的处理器与映射器配置方法)

    一.SpringMVC处理请求原理图(参见以前博客) 1.  用户发送请求至前端控制器DispatcherServlet 2.  DispatcherServlet收到请求调用HandlerMappi ...

  8. 微信小程序animation

    wxml <view class="background" animation="{{rotateData}}"> </view>< ...

  9. PAT_A1003#Emergency

    Source: PAT A1003 Emergency (25 分) Description: As an emergency rescue team leader of a city, you ar ...

  10. Python 递归、匿名函数、map和filter day4

    一.递归---函数自己调用自己 1.一个错误递归的例子: count=0 def hello(): global count count+=1 print("count %s"%c ...