File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -6,18 +6,22 @@ export function createChromeService() {
6
6
const loader = createCachedDataLoader <
7
7
string ,
8
8
Gql . ChromeExtension | undefined
9
- > ( HOUR_MS , ( ids ) =>
10
- Promise . all ( ids . map ( ( id ) => chrome . crawlExtension ( id , "en" ) ) ) ,
11
- ) ;
9
+ > ( HOUR_MS , async ( ids ) => {
10
+ const results = await Promise . allSettled (
11
+ ids . map ( ( id ) => chrome . crawlExtension ( id , "en" ) ) ,
12
+ ) ;
13
+ return results . map ( ( res ) =>
14
+ res . status === "fulfilled" ? res . value : res . reason ,
15
+ ) ;
16
+ } ) ;
12
17
13
18
return {
14
19
getExtension : ( id : string ) => loader . load ( id ) ,
15
20
getExtensions : async ( ids : string [ ] ) => {
16
21
const result = await loader . loadMany ( ids ) ;
17
- return result . map ( ( item ) => {
18
- if ( item == null ) return undefined ;
22
+ return result . map ( ( item , index ) => {
19
23
if ( item instanceof Error ) {
20
- console . warn ( "Error fetching multiple extensions:" , item ) ;
24
+ console . warn ( "Error loading extension:" , ids [ index ] , item ) ;
21
25
return undefined ;
22
26
}
23
27
return item ;
You can’t perform that action at this time.
0 commit comments