Let's say I built a pipe that contains a retryWhen
in the end to catch the errors. What's the difference between
retryWhen(err => {
return err.pipe(
tap(() => {console.log(`retrying...`)}),
delayWhen(() => timer(2000))
)
})
and
retryWhen(err => {
return err.pipe(
tap(() => {console.log(`retrying...`)}),
delay(2000)
)
})
besides the different usage of the two operators?
In this case there's no difference between them, both return an Observable that emits after 2 seconds.
You might prefer delay
as it's more explicit.