8
0
Maciej Bukowski 7 лет назад
Родитель
Сommit
79919f6c84

+ 3 - 2
packages/ckeditor5-widget/src/widgettoolbarrepository.js

@@ -3,6 +3,7 @@ import ContextualBalloon from '@ckeditor/ckeditor5-ui/src/panel/balloon/contextu
 import ToolbarView from '@ckeditor/ckeditor5-ui/src/toolbar/toolbarview';
 import BalloonPanelView from '@ckeditor/ckeditor5-ui/src/panel/balloon/balloonpanelview';
 import { isWidget } from './utils';
+import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 
 /**
  * Widget toolbar repository plugin. A central point for creating widget toolbars. This plugin handles the whole
@@ -112,7 +113,7 @@ export default class WidgetToolbarRepository extends Plugin {
 			 * @error widget-toolbar-duplicated
 			 * @param toolbarId Toolbar id.
 			 */
-			throw new Error( 'widget-toolbar-duplicated: Toolbar with the given id was already added.', { toolbarId } );
+			throw new CKEditorError( 'widget-toolbar-duplicated: Toolbar with the given id was already added.', { toolbarId } );
 		}
 
 		this._toolbars.set( toolbarId, {
@@ -137,7 +138,7 @@ export default class WidgetToolbarRepository extends Plugin {
 			 * @error widget-toolbar-does-not-exist
 			 * @param toolbarId Toolbar id.
 			 */
-			throw new Error( 'widget-toolbar-does-not-exist', { toolbarId } );
+			throw new CKEditorError( 'widget-toolbar-does-not-exist', { toolbarId } );
 		}
 
 		this._hideToolbar( toolbar );

+ 3 - 2
packages/ckeditor5-widget/tests/widgettoolbarrepository.js

@@ -20,6 +20,7 @@ import View from '@ckeditor/ckeditor5-ui/src/view';
 
 import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
+import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 
 describe( 'WidgetToolbar', () => {
 	let editor, model, balloon, widgetToolbarRepository, editorElement;
@@ -77,7 +78,7 @@ describe( 'WidgetToolbar', () => {
 					toolbarItems: editor.config.get( 'fake.toolbar' ),
 					whenVisible: () => false
 				} );
-			} ).to.throw( /widget-toolbar-duplicated/ );
+			} ).to.throw( CKEditorError, /^widget-toolbar-duplicated/ );
 		} );
 	} );
 
@@ -101,7 +102,7 @@ describe( 'WidgetToolbar', () => {
 
 			expect( () => {
 				widgetToolbarRepository.deregister( 'bar' );
-			} ).to.throw( /widget-toolbar-does-not-exist/ );
+			} ).to.throw( CKEditorError, /^widget-toolbar-does-not-exist/ );
 		} );
 	} );