Auto Retry Network calls - using Javascript 🔥

  Рет қаралды 4,034

Sourav Singh Diaries

Sourav Singh Diaries

3 жыл бұрын

For a web application, fetching API data is a common task.
But the API calls might fail because of Network problems. Usually we could show a screen for Network Error and ask users to retry.
One approach to handle this is auto retry when network error occurs.
You are asked to create a fetchWithAutoRetry(fetcher, count), which automatically fetch again when error happens, until the maximum count is met.
For the problem here, there is no need to detect network error, you can just retry on all promise rejections.
Solution Link : codesandbox.io/s/upbeat-burne...
#javascript #javascripttutorial #javascriptengineer #javascriptinterview

Пікірлер: 6
@lavanyaarumugam4055
@lavanyaarumugam4055 3 ай бұрын
Great explanation..Keep up the good work
@S4MBENTZ
@S4MBENTZ Жыл бұрын
add await delay(milis)
@sourabhbanka
@sourabhbanka 3 жыл бұрын
Nice explanation
@maheshpote7020
@maheshpote7020 2 жыл бұрын
Great. Just to know . How to nake this logic while upload download zip file. In createWriteStream func
@NEWAGEVINES
@NEWAGEVINES 3 жыл бұрын
Awesome
@likhitverma9661
@likhitverma9661 Жыл бұрын
Thanks... You saved my life 🥲🫂
5 Async + Await Error Handling Strategies
18:11
Wes Bos
Рет қаралды 20 М.
Compose and Pipe Functions in JavaScript | JavaScript Tutorial
12:08
Playing hide and seek with my dog 🐶
00:25
Zach King
Рет қаралды 32 МЛН
39kgのガリガリが踊る絵文字ダンス/39kg boney emoji dance#dance #ダンス #にんげんっていいな
00:16
💀Skeleton Ninja🥷【にんげんっていいなチャンネル】
Рет қаралды 8 МЛН
Fetch with Timeout | JavaScript Interview Question - 43
9:48
Learnersbucket
Рет қаралды 2,6 М.
JavaScript Tip: Handling a Failed HTTP Request with fetch
12:30
All Things JavaScript, LLC
Рет қаралды 24 М.
Javascript Design Patterns #9 - Retry Pattern
21:42
DevSage
Рет қаралды 10 М.
Promises From Scratch In A Post-Apocalyptic Future
23:15
Low Byte Productions
Рет қаралды 23 М.
JavaScript Fetch API - One Mistake I ALWAYS MAKE!
4:47
James Q Quick
Рет қаралды 23 М.
Playing hide and seek with my dog 🐶
00:25
Zach King
Рет қаралды 32 МЛН