-
Notifications
You must be signed in to change notification settings - Fork 972
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f72e7a
commit 8bb929b
Showing
32 changed files
with
2,420 additions
and
690 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
configured_endpoints: 55 | ||
configured_endpoints: 62 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Like `Promise.allSettled()` but throws an error if any promises are rejected. | ||
*/ | ||
export const allSettledWithThrow = async <R>(promises: Promise<R>[]): Promise<R[]> => { | ||
const results = await Promise.allSettled(promises); | ||
const rejected = results.filter((result): result is PromiseRejectedResult => result.status === 'rejected'); | ||
if (rejected.length) { | ||
for (const result of rejected) { | ||
console.error(result.reason); | ||
} | ||
|
||
throw new Error(`${rejected.length} promise(s) failed - see the above errors`); | ||
} | ||
|
||
// Note: TS was complaining about using `.filter().map()` here for some reason | ||
const values: R[] = []; | ||
for (const result of results) { | ||
if (result.status === 'fulfilled') { | ||
values.push(result.value); | ||
} | ||
} | ||
return values; | ||
}; |
Oops, something went wrong.