You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/11-async/08-async-await/04-promise-all-failure/solution.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ An ideal solution would be to cancel all unfinished queries when one of them fai
11
11
12
12
However, the bad news is that service calls (such as `database.query`) are often implemented by a 3rd-party library which doesn't support cancellation. Then there's no way to cancel a call.
13
13
14
-
Instead we can write our own wrapper function around `Promise.all` which adds a custom `then/catch` handler to each promise to track them: results are gathered and, if an error occurs, all subsequent promises are ignored.
14
+
As an alternative, we can write our own wrapper function around `Promise.all` which adds a custom `then/catch` handler to each promise to track them: results are gathered and, if an error occurs, all subsequent promises are ignored.
15
15
16
16
```js
17
17
functioncustomPromiseAll(promises) {
@@ -46,7 +46,7 @@ It may be important that all queries complete, especially if some of them make i
46
46
47
47
So we should wait until all promises are settled before going further with the execution and eventually disconnecting.
48
48
49
-
Here's one more implementation. It also resolves with the first error, but waits until all promises are settled.
49
+
Here's another implementation. It also resolves with the first error, but waits until all promises are settled.
0 commit comments