@@ -14,9 +14,8 @@ import {
1414} from '@openfeature/server-sdk' ;
1515import { BeforeHookContext , ProviderMetadata } from '@openfeature/core' ;
1616import { HookExecutor } from './hook-executor' ;
17- import { AggregateError } from './errors' ;
18- import { BaseEvaluationStrategy , ProviderResolutionResult } from './strategies/BaseEvaluationStrategy' ;
19- import { FirstMatchStrategy } from './strategies/FirstMatchStrategy' ;
17+ import { constructAggregateError } from './errors' ;
18+ import { BaseEvaluationStrategy , ProviderResolutionResult , FirstMatchStrategy } from './strategies' ;
2019import { StatusTracker } from './status-tracker' ;
2120
2221// Represents an entry in the constructor's provider array which may or may not have a name set
@@ -181,7 +180,7 @@ export class MultiProvider implements Provider {
181180 const finalResult = this . evaluationStrategy . determineFinalResult ( { flagKey, flagType } , context , resolutions ) ;
182181
183182 if ( finalResult . errors ?. length ) {
184- throw this . constructAggregateError ( finalResult . errors ) ;
183+ throw constructAggregateError ( finalResult . errors ) ;
185184 }
186185
187186 if ( ! finalResult . details ) {
@@ -323,18 +322,4 @@ export class MultiProvider implements Provider {
323322 } ,
324323 ] ;
325324 }
326-
327- private constructAggregateError ( providerErrors : { error : unknown ; providerName : string } [ ] ) {
328- const errorsWithSource = providerErrors
329- . map ( ( { providerName, error } ) => {
330- return { source : providerName , error } ;
331- } )
332- . flat ( ) ;
333-
334- // log first error in the message for convenience, but include all errors in the error object for completeness
335- return new AggregateError (
336- `Provider errors occurred: ${ errorsWithSource [ 0 ] . source } : ${ errorsWithSource [ 0 ] . error } ` ,
337- errorsWithSource ,
338- ) ;
339- }
340325}
0 commit comments