File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -10,20 +10,11 @@ function isExternalHostError(err: any): err is ExternalHostError {
1010 return err instanceof ExternalHostError ;
1111}
1212
13- function handleError ( err : any ) : never {
14- if ( ! ( err instanceof AggregateError ) ) {
15- throw err ;
16- }
17-
18- logger . debug ( { err } , 'Aggregate error is thrown' ) ;
19-
20- const errors = [ ...err ] ;
21-
13+ function handleMultipleErrors ( errors : Error [ ] ) : never {
2214 const hostError = errors . find ( isExternalHostError ) ;
2315 if ( hostError ) {
2416 throw hostError ;
2517 }
26-
2718 if (
2819 errors . length === 1 ||
2920 new Set ( errors . map ( ( { message } ) => message ) ) . size === 1
@@ -32,7 +23,16 @@ function handleError(err: any): never {
3223 throw error ;
3324 }
3425
35- throw err ;
26+ throw new AggregateError ( errors ) ;
27+ }
28+
29+ function handleError ( err : any ) : never {
30+ if ( ! ( err instanceof AggregateError ) ) {
31+ throw err ;
32+ }
33+
34+ logger . debug ( { err } , 'Aggregate error is thrown' ) ;
35+ handleMultipleErrors ( [ ...err ] ) ;
3636}
3737
3838export async function all < T > (
You can’t perform that action at this time.
0 commit comments