Skip to content

Commit f775835

Browse files
committed
minor fixes
1 parent f0d8abb commit f775835

File tree

1 file changed

+2
-2
lines changed
  • 1-js/11-async/08-async-await/04-promise-all-failure

1 file changed

+2
-2
lines changed

1-js/11-async/08-async-await/04-promise-all-failure/solution.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ The problem is especially dangerous in server-side environments, such as Node.js
77

88
How to fix it?
99

10-
A natural solution would be to cancel all unfinished queries when one of them fails. This way we avoid any potential errors.
10+
An ideal solution would be to cancel all unfinished queries when one of them fails. This way we avoid any potential errors.
1111

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. So there's usually no way to cancel a call.
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.
1313

1414
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.
1515

0 commit comments

Comments
 (0)