File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -6,18 +6,22 @@ export function createChromeService() {
66 const loader = createCachedDataLoader <
77 string ,
88 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+ } ) ;
1217
1318 return {
1419 getExtension : ( id : string ) => loader . load ( id ) ,
1520 getExtensions : async ( ids : string [ ] ) => {
1621 const result = await loader . loadMany ( ids ) ;
17- return result . map ( ( item ) => {
18- if ( item == null ) return undefined ;
22+ return result . map ( ( item , index ) => {
1923 if ( item instanceof Error ) {
20- console . warn ( "Error fetching multiple extensions:" , item ) ;
24+ console . warn ( "Error loading extension:" , ids [ index ] , item ) ;
2125 return undefined ;
2226 }
2327 return item ;
You can’t perform that action at this time.
0 commit comments