diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 1a433b0..5dc3665 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -173,7 +173,7 @@ { if (index < 0 || index >= this.children.length) { - throw new Error('The supplied index is out of bounds'); + throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`); } const currentIndex = this.getChildIndex(child); diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 1a433b0..5dc3665 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -173,7 +173,7 @@ { if (index < 0 || index >= this.children.length) { - throw new Error('The supplied index is out of bounds'); + throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`); } const currentIndex = this.getChildIndex(child); diff --git a/test/core/Container.js b/test/core/Container.js index cefde54..9f9333d 100644 --- a/test/core/Container.js +++ b/test/core/Container.js @@ -361,8 +361,8 @@ container.addChild(child); - expect(() => container.setChildIndex(child, -1)).to.throw('The supplied index is out of bounds'); - expect(() => container.setChildIndex(child, 1)).to.throw('The supplied index is out of bounds'); + expect(() => container.setChildIndex(child, -1)).to.throw('The index -1 supplied is out of bounds 1'); + expect(() => container.setChildIndex(child, 1)).to.throw('The index 1 supplied is out of bounds 1'); }); it('should throw when child does not belong', function ()