File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
packages/esl/src/esl-carousel/core Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -297,10 +297,12 @@ export class ESLCarousel extends ESLBaseElement {
297
297
}
298
298
299
299
/** Goes to the target according to passed params */
300
- public goTo ( target : HTMLElement | ESLCarouselSlideTarget , params : Partial < ESLCarouselActionParams > = { } ) : Promise < void > {
300
+ public async goTo ( target : HTMLElement | ESLCarouselSlideTarget , params : Partial < ESLCarouselActionParams > = { } ) : Promise < void > {
301
301
if ( target instanceof HTMLElement ) return this . goTo ( this . indexOf ( target ) , params ) ;
302
- if ( ! this . renderer ) return Promise . reject ( ) ;
303
- return this . renderer . navigate ( toIndex ( target , this . state ) , this . mergeParams ( params ) ) ;
302
+ if ( ! this . renderer ) throw new Error ( 'Renderer is not available' ) ;
303
+ const index = toIndex ( target , this . state ) ;
304
+ if ( isNaN ( index . index ) ) throw new Error ( `Invalid target index passed ${ target } ` ) ;
305
+ return this . renderer . navigate ( index , this . mergeParams ( params ) ) ;
304
306
}
305
307
306
308
/** Moves slides by the passed offset */
You can’t perform that action at this time.
0 commit comments