From fcd0922a4ad964ab6d46c97d33cf8576e0dea001 Mon Sep 17 00:00:00 2001 From: Maciej Bukowski Date: Fri, 28 Jun 2019 09:24:43 +0200 Subject: [PATCH 1/3] WIP - changing errors. --- tests/componentfactory.js | 15 +++++----- tests/dropdown/utils.js | 4 +-- tests/panel/balloon/contextualballoon.js | 33 +++++++++++----------- tests/template.js | 36 ++++++++++++------------ tests/view.js | 7 +++-- tests/viewcollection.js | 19 +++++++------ 6 files changed, 58 insertions(+), 56 deletions(-) diff --git a/tests/componentfactory.js b/tests/componentfactory.js index cff5f7a4..a3b401cb 100644 --- a/tests/componentfactory.js +++ b/tests/componentfactory.js @@ -5,7 +5,8 @@ import Editor from '@ckeditor/ckeditor5-core/src/editor/editor'; import ComponentFactory from '../src/componentfactory'; -import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; + +import { expectToThrowCKEditorError } from '@ckeditor/ckeditor5-utils/tests/_utils/utils'; describe( 'ComponentFactory', () => { let editor, factory; @@ -41,17 +42,17 @@ describe( 'ComponentFactory', () => { it( 'throws when trying to override already registered component', () => { factory.add( 'foo', () => {} ); - expect( () => { + expectToThrowCKEditorError( () => { factory.add( 'foo', () => {} ); - } ).to.throw( CKEditorError, /^componentfactory-item-exists/ ); + }, /^componentfactory-item-exists/, editor ); } ); it( 'throws when trying to override already registered component added with different case', () => { factory.add( 'Foo', () => {} ); - expect( () => { + expectToThrowCKEditorError( () => { factory.add( 'foo', () => {} ); - } ).to.throw( CKEditorError, /^componentfactory-item-exists/ ); + }, /^componentfactory-item-exists/, editor ); } ); it( 'does not normalize component names', () => { @@ -63,9 +64,9 @@ describe( 'ComponentFactory', () => { describe( 'create()', () => { it( 'throws when trying to create a component which has not been registered', () => { - expect( () => { + expectToThrowCKEditorError( () => { factory.create( 'foo' ); - } ).to.throw( CKEditorError, /^componentfactory-item-missing/ ); + }, /^componentfactory-item-missing/, editor ); } ); it( 'creates an instance', () => { diff --git a/tests/dropdown/utils.js b/tests/dropdown/utils.js index 327371ad..08a0fa6f 100644 --- a/tests/dropdown/utils.js +++ b/tests/dropdown/utils.js @@ -5,7 +5,7 @@ /* globals document Event */ -import utilsTestUtils from '@ckeditor/ckeditor5-utils/tests/_utils/utils'; +import { assertBinding } from '@ckeditor/ckeditor5-utils/tests/_utils/utils'; import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard'; import Collection from '@ckeditor/ckeditor5-utils/src/collection'; @@ -23,8 +23,6 @@ import ListItemView from '../../src/list/listitemview'; import ListSeparatorView from '../../src/list/listseparatorview'; import ListView from '../../src/list/listview'; -const assertBinding = utilsTestUtils.assertBinding; - describe( 'utils', () => { let locale, dropdownView; diff --git a/tests/panel/balloon/contextualballoon.js b/tests/panel/balloon/contextualballoon.js index c6f28480..bf65c72d 100644 --- a/tests/panel/balloon/contextualballoon.js +++ b/tests/panel/balloon/contextualballoon.js @@ -7,12 +7,13 @@ import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictest import ContextualBalloon from '../../../src/panel/balloon/contextualballoon'; import BalloonPanelView from '../../../src/panel/balloon/balloonpanelview'; import View from '../../../src/view'; -import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; + import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; import { add as addTranslations, _clear as clearTranslations } from '@ckeditor/ckeditor5-utils/src/translation-service'; import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils'; +import { expectToThrowCKEditorError } from '@ckeditor/ckeditor5-utils/tests/_utils/utils'; /* global document, Event */ @@ -238,7 +239,7 @@ describe( 'ContextualBalloon', () => { } ); it( 'should throw an error when try to add the same view more than once', () => { - expect( () => { + expectToThrowCKEditorError( () => { balloon.add( { view: viewA, position: { @@ -246,7 +247,7 @@ describe( 'ContextualBalloon', () => { limiter: balloon.positionLimiter } } ); - } ).to.throw( CKEditorError, /^contextualballoon-add-view-exist/ ); + }, /^contextualballoon-add-view-exist/, editor ); } ); it( 'should use a provided limiter instead of #positionLimiter', () => { @@ -453,15 +454,15 @@ describe( 'ContextualBalloon', () => { } ); it( 'should do nothing when given stack is already visible', () => { - expect( () => { + expectToThrowCKEditorError( () => { balloon.showStack( 'main' ); } ).to.not.throw(); } ); it( 'should throw an error when there is no stack of given id', () => { - expect( () => { + expectToThrowCKEditorError( () => { balloon.showStack( 'second' ); - } ).to.throw( CKEditorError, 'contextualballoon-showstack-stack-not-exist: Cannot show not existing stack.' ); + }, 'contextualballoon-showstack-stack-not-exist: Cannot show not existing stack.', editor ); } ); } ); @@ -489,7 +490,7 @@ describe( 'ContextualBalloon', () => { balloon.remove( viewB ); expect( balloon.visibleView ).to.equal( viewA ); - expect( () => { + expectToThrowCKEditorError( () => { balloon.showStack( 'second' ); } ).to.not.throw(); } ); @@ -503,7 +504,7 @@ describe( 'ContextualBalloon', () => { balloon.remove( viewB ); expect( balloon.visibleView ).to.equal( viewA ); - expect( () => { + expectToThrowCKEditorError( () => { balloon.showStack( 'second' ); } ).to.throw(); } ); @@ -517,7 +518,7 @@ describe( 'ContextualBalloon', () => { balloon.remove( viewA ); expect( balloon.visibleView ).to.equal( viewB ); - expect( () => { + expectToThrowCKEditorError( () => { balloon.showStack( 'main' ); } ).to.throw(); } ); @@ -573,7 +574,7 @@ describe( 'ContextualBalloon', () => { expect( balloon.hasView( viewC ) ).to.true; // Does not throw, so the stack is there. - expect( () => { + expectToThrowCKEditorError( () => { balloon.showStack( 'second' ); } ).to.not.throw(); } ); @@ -592,15 +593,15 @@ describe( 'ContextualBalloon', () => { expect( balloon.hasView( viewB ) ).to.false; // Does throw, so the stack is not there. - expect( () => { + expectToThrowCKEditorError( () => { balloon.showStack( 'second' ); } ).to.throw(); } ); it( 'should throw an error when there is no given view in the stack', () => { - expect( () => { + expectToThrowCKEditorError( () => { balloon.remove( viewB ); - } ).to.throw( CKEditorError, /^contextualballoon-remove-view-not-exist/ ); + }, /^contextualballoon-remove-view-not-exist/, editor ); } ); it( 'should set additional css class of visible view to BalloonPanelView', () => { @@ -707,15 +708,15 @@ describe( 'ContextualBalloon', () => { } ); it( 'should throw an error when there is no given view in the stack', () => { - expect( () => { + expectToThrowCKEditorError( () => { balloon.remove( viewB ); - } ).to.throw( CKEditorError, /^contextualballoon-remove-view-not-exist/ ); + }, /^contextualballoon-remove-view-not-exist/, editor ); } ); } ); describe( 'destroy()', () => { it( 'can be called multiple times', () => { - expect( () => { + expectToThrowCKEditorError( () => { balloon.destroy(); balloon.destroy(); } ).to.not.throw(); diff --git a/tests/template.js b/tests/template.js index 4d69abc7..706cb57e 100644 --- a/tests/template.js +++ b/tests/template.js @@ -10,7 +10,7 @@ import { default as Template, TemplateToBinding, TemplateIfBinding } from '../sr import View from '../src/view'; import ViewCollection from '../src/viewcollection'; import Model from '../src/model'; -import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; + import EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin'; import DomEmitterMixin from '@ckeditor/ckeditor5-utils/src/dom/emittermixin'; import normalizeHtml from '@ckeditor/ckeditor5-utils/tests/_utils/normalizehtml'; @@ -142,16 +142,16 @@ describe( 'Template', () => { describe( 'render()', () => { it( 'throws when the template definition is wrong', () => { - expect( () => { + expectToThrowCKEditorError( () => { new Template( {} ).render(); - } ).to.throw( CKEditorError, /ui-template-wrong-syntax/ ); + }, /ui-template-wrong-syntax/ ); - expect( () => { + expectToThrowCKEditorError( () => { new Template( { tag: 'p', text: 'foo' } ).render(); - } ).to.throw( CKEditorError, /ui-template-wrong-syntax/ ); + }, /ui-template-wrong-syntax/ ); } ); it( 'sets #_isRendered true', () => { @@ -645,7 +645,7 @@ describe( 'Template', () => { strongView.set( 'id' ); - expect( () => { + expectToThrowCKEditorError( () => { getView( { tag: 'div', children: [ @@ -727,12 +727,12 @@ describe( 'Template', () => { } ); it( 'throws when wrong template definition', () => { - expect( () => { + expectToThrowCKEditorError( () => { new Template( { tag: 'p', text: 'foo' } ).apply( el ); - } ).to.throw( CKEditorError, /ui-template-wrong-syntax/ ); + }, /ui-template-wrong-syntax/ ); } ); it( 'accepts empty template definition', () => { @@ -1119,15 +1119,15 @@ describe( 'Template', () => { tag: 'div' } ); - expect( () => { + expectToThrowCKEditorError( () => { tpl.revert( el ); - } ).to.throw( CKEditorError, /ui-template-revert-not-applied/ ); + }, /ui-template-revert-not-applied/ ); tpl.render(); - expect( () => { + expectToThrowCKEditorError( () => { tpl.revert( el ); - } ).to.throw( CKEditorError, /ui-template-revert-not-applied/ ); + }, /ui-template-revert-not-applied/ ); } ); describe( 'text', () => { @@ -2691,7 +2691,7 @@ describe( 'Template', () => { describe( 'children', () => { it( 'should throw when the number of children does not correspond', () => { - expect( () => { + expectToThrowCKEditorError( () => { extensionTest( { tag: 'p', @@ -2707,11 +2707,11 @@ describe( 'Template', () => { }, 'it should fail' ); - } ).to.throw( CKEditorError, /ui-template-extend-children-mismatch/ ); + }, /ui-template-extend-children-mismatch/ ); } ); it( 'should throw when no children in target but extending one', () => { - expect( () => { + expectToThrowCKEditorError( () => { extensionTest( { tag: 'p', @@ -2725,11 +2725,11 @@ describe( 'Template', () => { }, 'it should fail' ); - } ).to.throw( CKEditorError, /ui-template-extend-children-mismatch/ ); + }, /ui-template-extend-children-mismatch/ ); } ); it( 'should throw when the number of children does not correspond on some deeper level', () => { - expect( () => { + expectToThrowCKEditorError( () => { extensionTest( { tag: 'p', @@ -2768,7 +2768,7 @@ describe( 'Template', () => { }, 'it should fail' ); - } ).to.throw( CKEditorError, /ui-template-extend-children-mismatch/ ); + }, /ui-template-extend-children-mismatch/ ); } ); it( 'extends existing - simple', () => { diff --git a/tests/view.js b/tests/view.js index 4595b1cf..9fe170fe 100644 --- a/tests/view.js +++ b/tests/view.js @@ -8,10 +8,11 @@ import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils'; import View from '../src/view'; import Template from '../src/template'; -import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; + import Collection from '@ckeditor/ckeditor5-utils/src/collection'; import ViewCollection from '../src/viewcollection'; import normalizeHtml from '@ckeditor/ckeditor5-utils/tests/_utils/normalizehtml'; +import { assertCKEditorError } from '@ckeditor/ckeditor5-utils/tests/_utils/utils'; let TestView, view, childA, childB; @@ -215,8 +216,8 @@ describe( 'View', () => { view.render(); throw new Error( 'This should not be executed.' ); } catch ( err ) { - expect( err ).to.be.instanceof( CKEditorError ); - expect( err.message ).to.match( /^ui-view-render-already-rendered:/ ); + // TODO + assertCKEditorError( err, /^ui-view-render-already-rendered:/, view ); } } ); diff --git a/tests/viewcollection.js b/tests/viewcollection.js index 4ac574b5..67bbae78 100644 --- a/tests/viewcollection.js +++ b/tests/viewcollection.js @@ -5,11 +5,12 @@ /* global document */ -import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; + import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils'; import View from '../src/view'; import ViewCollection from '../src/viewcollection'; import normalizeHtml from '@ckeditor/ckeditor5-utils/tests/_utils/normalizehtml'; +import { expectToThrowCKEditorError } from '@ckeditor/ckeditor5-utils/tests/_utils/utils'; let collection; @@ -38,12 +39,12 @@ describe( 'ViewCollection', () => { const viewA = new View(); - expect( () => { + expectToThrowCKEditorError( () => { collection.add( viewA ); collection.remove( viewA ); } ).to.not.throw(); - expect( () => { + expectToThrowCKEditorError( () => { collection.add( viewA ); collection.remove( viewA ); } ).to.not.throw(); @@ -169,17 +170,17 @@ describe( 'ViewCollection', () => { describe( 'delegate()', () => { it( 'should throw when event names are not strings', () => { - expect( () => { + expectToThrowCKEditorError( () => { collection.delegate(); - } ).to.throw( CKEditorError, /ui-viewcollection-delegate-wrong-events/ ); + }, /ui-viewcollection-delegate-wrong-events/ ); - expect( () => { + expectToThrowCKEditorError( () => { collection.delegate( new Date() ); - } ).to.throw( CKEditorError, /ui-viewcollection-delegate-wrong-events/ ); + }, /ui-viewcollection-delegate-wrong-events/ ); - expect( () => { + expectToThrowCKEditorError( () => { collection.delegate( 'color', new Date() ); - } ).to.throw( CKEditorError, /ui-viewcollection-delegate-wrong-events/ ); + }, /ui-viewcollection-delegate-wrong-events/ ); } ); it( 'returns object', () => { From e9010235e196161a97305bf4d3fffcf32476d796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Wr=C3=B3bel?= Date: Mon, 1 Jul 2019 11:11:16 +0200 Subject: [PATCH 2/3] Fixed failing tests. --- tests/panel/balloon/contextualballoon.js | 18 +++++++++--------- tests/template.js | 4 +++- tests/viewcollection.js | 5 ++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/panel/balloon/contextualballoon.js b/tests/panel/balloon/contextualballoon.js index bf65c72d..c21be184 100644 --- a/tests/panel/balloon/contextualballoon.js +++ b/tests/panel/balloon/contextualballoon.js @@ -454,7 +454,7 @@ describe( 'ContextualBalloon', () => { } ); it( 'should do nothing when given stack is already visible', () => { - expectToThrowCKEditorError( () => { + expect( () => { balloon.showStack( 'main' ); } ).to.not.throw(); } ); @@ -462,7 +462,7 @@ describe( 'ContextualBalloon', () => { it( 'should throw an error when there is no stack of given id', () => { expectToThrowCKEditorError( () => { balloon.showStack( 'second' ); - }, 'contextualballoon-showstack-stack-not-exist: Cannot show not existing stack.', editor ); + }, /^contextualballoon-showstack-stack-not-exist/, editor ); } ); } ); @@ -490,7 +490,7 @@ describe( 'ContextualBalloon', () => { balloon.remove( viewB ); expect( balloon.visibleView ).to.equal( viewA ); - expectToThrowCKEditorError( () => { + expect( () => { balloon.showStack( 'second' ); } ).to.not.throw(); } ); @@ -506,7 +506,7 @@ describe( 'ContextualBalloon', () => { expect( balloon.visibleView ).to.equal( viewA ); expectToThrowCKEditorError( () => { balloon.showStack( 'second' ); - } ).to.throw(); + }, /^contextualballoon-showstack-stack-not-exist/, editor ); } ); it( 'should switch stack to the next one when removed view was the last one in the visible stack', () => { @@ -520,7 +520,7 @@ describe( 'ContextualBalloon', () => { expect( balloon.visibleView ).to.equal( viewB ); expectToThrowCKEditorError( () => { balloon.showStack( 'main' ); - } ).to.throw(); + }, /^contextualballoon-showstack-stack-not-exist/, editor ); } ); it( 'should remove given view and set preceding in the stack as visible when removed view was visible', () => { @@ -574,7 +574,7 @@ describe( 'ContextualBalloon', () => { expect( balloon.hasView( viewC ) ).to.true; // Does not throw, so the stack is there. - expectToThrowCKEditorError( () => { + expect( () => { balloon.showStack( 'second' ); } ).to.not.throw(); } ); @@ -595,7 +595,7 @@ describe( 'ContextualBalloon', () => { // Does throw, so the stack is not there. expectToThrowCKEditorError( () => { balloon.showStack( 'second' ); - } ).to.throw(); + }, /^contextualballoon-showstack-stack-not-exist/, editor ); } ); it( 'should throw an error when there is no given view in the stack', () => { @@ -716,10 +716,10 @@ describe( 'ContextualBalloon', () => { describe( 'destroy()', () => { it( 'can be called multiple times', () => { - expectToThrowCKEditorError( () => { + expect( () => { balloon.destroy(); balloon.destroy(); - } ).to.not.throw(); + } ); } ); it( 'should not touch the DOM', () => { diff --git a/tests/template.js b/tests/template.js index 706cb57e..f5d5078f 100644 --- a/tests/template.js +++ b/tests/template.js @@ -16,6 +16,8 @@ import DomEmitterMixin from '@ckeditor/ckeditor5-utils/src/dom/emittermixin'; import normalizeHtml from '@ckeditor/ckeditor5-utils/tests/_utils/normalizehtml'; import log from '@ckeditor/ckeditor5-utils/src/log'; +import { expectToThrowCKEditorError } from '@ckeditor/ckeditor5-utils/tests/_utils/utils'; + let el, text; const injectedElements = []; @@ -645,7 +647,7 @@ describe( 'Template', () => { strongView.set( 'id' ); - expectToThrowCKEditorError( () => { + expect( () => { getView( { tag: 'div', children: [ diff --git a/tests/viewcollection.js b/tests/viewcollection.js index 67bbae78..2ac661d5 100644 --- a/tests/viewcollection.js +++ b/tests/viewcollection.js @@ -5,7 +5,6 @@ /* global document */ - import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils'; import View from '../src/view'; import ViewCollection from '../src/viewcollection'; @@ -39,12 +38,12 @@ describe( 'ViewCollection', () => { const viewA = new View(); - expectToThrowCKEditorError( () => { + expect( () => { collection.add( viewA ); collection.remove( viewA ); } ).to.not.throw(); - expectToThrowCKEditorError( () => { + expect( () => { collection.add( viewA ); collection.remove( viewA ); } ).to.not.throw(); From cd61e9b5f0c031035bff6021532b653900f3f493 Mon Sep 17 00:00:00 2001 From: Maciej Bukowski Date: Tue, 2 Jul 2019 01:41:52 +0200 Subject: [PATCH 3/3] Fixed error contexts. --- src/componentfactory.js | 8 ++++++-- src/panel/balloon/contextualballoon.js | 15 ++++++++++++--- src/template.js | 12 +++++++++--- src/view.js | 5 ++++- src/viewcollection.js | 5 ++++- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/componentfactory.js b/src/componentfactory.js index 31f5b48a..3e21ecec 100644 --- a/src/componentfactory.js +++ b/src/componentfactory.js @@ -85,7 +85,9 @@ export default class ComponentFactory { * @param {String} name The name of the component. */ throw new CKEditorError( - 'componentfactory-item-exists: The item already exists in the component factory.', { name } + 'componentfactory-item-exists: The item already exists in the component factory.', + this, + { name } ); } @@ -113,7 +115,9 @@ export default class ComponentFactory { * @param {String} name The name of the missing component. */ throw new CKEditorError( - 'componentfactory-item-missing: The required component is not registered in the factory.', { name } + 'componentfactory-item-missing: The required component is not registered in the factory.', + this, + { name } ); } diff --git a/src/panel/balloon/contextualballoon.js b/src/panel/balloon/contextualballoon.js index 91db6aa7..151d1b44 100644 --- a/src/panel/balloon/contextualballoon.js +++ b/src/panel/balloon/contextualballoon.js @@ -199,7 +199,10 @@ export default class ContextualBalloon extends Plugin { * * @error contextualballoon-add-view-exist */ - throw new CKEditorError( 'contextualballoon-add-view-exist: Cannot add configuration of the same view twice.' ); + throw new CKEditorError( + 'contextualballoon-add-view-exist: Cannot add configuration of the same view twice.', + [ this, data ] + ); } const stackId = data.stackId || 'main'; @@ -248,7 +251,10 @@ export default class ContextualBalloon extends Plugin { * * @error contextualballoon-remove-view-not-exist */ - throw new CKEditorError( 'contextualballoon-remove-view-not-exist: Cannot remove the configuration of a non-existent view.' ); + throw new CKEditorError( + 'contextualballoon-remove-view-not-exist: Cannot remove the configuration of a non-existent view.', + [ this, view ] + ); } const stack = this._viewToStack.get( view ); @@ -313,7 +319,10 @@ export default class ContextualBalloon extends Plugin { * * @error contextualballoon-showstack-stack-not-exist */ - throw new CKEditorError( 'contextualballoon-showstack-stack-not-exist: Cannot show a stack that does not exist.' ); + throw new CKEditorError( + 'contextualballoon-showstack-stack-not-exist: Cannot show a stack that does not exist.', + this + ); } if ( this._visibleStack === stack ) { diff --git a/src/template.js b/src/template.js index 45e3f165..621e5227 100644 --- a/src/template.js +++ b/src/template.js @@ -208,7 +208,10 @@ export default class Template { * * @error ui-template-revert-not-applied */ - throw new CKEditorError( 'ui-template-revert-not-applied: Attempting to revert a template which has not been applied yet.' ); + throw new CKEditorError( + 'ui-template-revert-not-applied: Attempting to revert a template which has not been applied yet.', + [ this, node ] + ); } this._revertTemplateFromNode( node, this._revertData ); @@ -409,7 +412,8 @@ export default class Template { * @error ui-template-wrong-syntax */ throw new CKEditorError( - 'ui-template-wrong-syntax: Node definition must have either "tag" or "text" when rendering a new Node.' + 'ui-template-wrong-syntax: Node definition must have either "tag" or "text" when rendering a new Node.', + this ); } @@ -1356,6 +1360,7 @@ function extendObjectValueArray( obj, ext ) { // // @param {module:ui/template~Template} def A template instance to be extended. // @param {module:ui/template~TemplateDefinition} def A definition which is to extend the template instance. +// @param {Object} Error context. function extendTemplate( template, def ) { if ( def.attributes ) { if ( !template.attributes ) { @@ -1385,7 +1390,8 @@ function extendTemplate( template, def ) { * @error ui-template-extend-children-mismatch */ throw new CKEditorError( - 'ui-template-extend-children-mismatch: The number of children in extended definition does not match.' + 'ui-template-extend-children-mismatch: The number of children in extended definition does not match.', + template ); } diff --git a/src/view.js b/src/view.js index 192842f6..611e2668 100644 --- a/src/view.js +++ b/src/view.js @@ -467,7 +467,10 @@ export default class View { * * @error ui-view-render-rendered */ - throw new CKEditorError( 'ui-view-render-already-rendered: This View has already been rendered.' ); + throw new CKEditorError( + 'ui-view-render-already-rendered: This View has already been rendered.', + this + ); } // Render #element of the view. diff --git a/src/viewcollection.js b/src/viewcollection.js index e628ec99..87174da4 100644 --- a/src/viewcollection.js +++ b/src/viewcollection.js @@ -154,7 +154,10 @@ export default class ViewCollection extends Collection { * * @error ui-viewcollection-delegate-wrong-events */ - throw new CKEditorError( 'ui-viewcollection-delegate-wrong-events: All event names must be strings.' ); + throw new CKEditorError( + 'ui-viewcollection-delegate-wrong-events: All event names must be strings.', + this + ); } return {