@@ -16,7 +16,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
1616import { StandardKeyboardEvent , IKeyboardEvent } from 'vs/base/browser/keyboardEvent' ;
1717import { Event , Emitter , EventBufferer } from 'vs/base/common/event' ;
1818import { domEvent } from 'vs/base/browser/event' ;
19- import { IListVirtualDelegate , IListRenderer , IListEvent , IListContextMenuEvent , IListMouseEvent , IListTouchEvent , IListGestureEvent , IIdentityProvider , IKeyboardNavigationLabelProvider , IListDragAndDrop , IListDragOverReaction , ListAriaRootRole } from './list' ;
19+ import { IListVirtualDelegate , IListRenderer , IListEvent , IListContextMenuEvent , IListMouseEvent , IListTouchEvent , IListGestureEvent , IIdentityProvider , IKeyboardNavigationLabelProvider , IListDragAndDrop , IListDragOverReaction , ListAriaRootRole , ListError } from './list' ;
2020import { ListView , IListViewOptions , IListViewDragAndDrop , IAriaProvider } from './listView' ;
2121import { Color } from 'vs/base/common/color' ;
2222import { mixin } from 'vs/base/common/objects' ;
@@ -1170,6 +1170,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
11701170 readonly onDidDispose : Event < void > = this . _onDidDispose . event ;
11711171
11721172 constructor (
1173+ private user : string ,
11731174 container : HTMLElement ,
11741175 virtualDelegate : IListVirtualDelegate < T > ,
11751176 renderers : IListRenderer < any /* TODO@joao */ , any > [ ] ,
@@ -1261,11 +1262,11 @@ export class List<T> implements ISpliceable<T>, IDisposable {
12611262
12621263 splice ( start : number , deleteCount : number , elements : T [ ] = [ ] ) : void {
12631264 if ( start < 0 || start > this . view . length ) {
1264- throw new Error ( `Invalid start index: ${ start } ` ) ;
1265+ throw new ListError ( this . user , `Invalid start index: ${ start } ` ) ;
12651266 }
12661267
12671268 if ( deleteCount < 0 ) {
1268- throw new Error ( `Invalid delete count: ${ deleteCount } ` ) ;
1269+ throw new ListError ( this . user , `Invalid delete count: ${ deleteCount } ` ) ;
12691270 }
12701271
12711272 if ( deleteCount === 0 && elements . length === 0 ) {
@@ -1348,7 +1349,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
13481349 setSelection ( indexes : number [ ] , browserEvent ?: UIEvent ) : void {
13491350 for ( const index of indexes ) {
13501351 if ( index < 0 || index >= this . length ) {
1351- throw new Error ( `Invalid index ${ index } ` ) ;
1352+ throw new ListError ( this . user , `Invalid index ${ index } ` ) ;
13521353 }
13531354 }
13541355
@@ -1366,7 +1367,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
13661367 setFocus ( indexes : number [ ] , browserEvent ?: UIEvent ) : void {
13671368 for ( const index of indexes ) {
13681369 if ( index < 0 || index >= this . length ) {
1369- throw new Error ( `Invalid index ${ index } ` ) ;
1370+ throw new ListError ( this . user , `Invalid index ${ index } ` ) ;
13701371 }
13711372 }
13721373
@@ -1518,7 +1519,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
15181519
15191520 reveal ( index : number , relativeTop ?: number ) : void {
15201521 if ( index < 0 || index >= this . length ) {
1521- throw new Error ( `Invalid index ${ index } ` ) ;
1522+ throw new ListError ( this . user , `Invalid index ${ index } ` ) ;
15221523 }
15231524
15241525 const scrollTop = this . view . getScrollTop ( ) ;
@@ -1547,7 +1548,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
15471548 */
15481549 getRelativeTop ( index : number ) : number | null {
15491550 if ( index < 0 || index >= this . length ) {
1550- throw new Error ( `Invalid index ${ index } ` ) ;
1551+ throw new ListError ( this . user , `Invalid index ${ index } ` ) ;
15511552 }
15521553
15531554 const scrollTop = this . view . getScrollTop ( ) ;
@@ -1574,7 +1575,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
15741575 open ( indexes : number [ ] , browserEvent ?: UIEvent ) : void {
15751576 for ( const index of indexes ) {
15761577 if ( index < 0 || index >= this . length ) {
1577- throw new Error ( `Invalid index ${ index } ` ) ;
1578+ throw new ListError ( this . user , `Invalid index ${ index } ` ) ;
15781579 }
15791580 }
15801581
@@ -1584,7 +1585,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
15841585 pin ( indexes : number [ ] ) : void {
15851586 for ( const index of indexes ) {
15861587 if ( index < 0 || index >= this . length ) {
1587- throw new Error ( `Invalid index ${ index } ` ) ;
1588+ throw new ListError ( this . user , `Invalid index ${ index } ` ) ;
15881589 }
15891590 }
15901591
0 commit comments