import { ErrorHandler } from '../handler/ErrorHandler' ; import { ErrorMapper } from './ErrorMapper' ; /**
 * Generic implementation of @{link ErrorMapper}
 */ export class GenericErrorMapper < Input , Output > implements ErrorMapper < Input , Output > { protected errorHandlers : Array < ErrorHandler < Input , Output > > ; constructor ( options ) { this . errorHandlers = options . errorHandlers ; } public async getErrorHandler ( handlerInput , error ) { for ( const errorHandler of this . errorHandlers ) { if ( await errorHandler . canHandle ( handlerInput , error ) ) { return errorHandler ; } } return null ; } }