Sfoglia il codice sorgente

Updated error names.

Maksymilian Barnaś 9 anni fa
parent
commit
955cad14ea

+ 4 - 4
packages/ckeditor5-engine/src/conversion/viewconsumable.js

@@ -55,7 +55,7 @@ class ViewElementConsumables {
 	 *		consumables.add( { attribute: 'title', class: 'foo', style: 'color' } );
 	 *		consumables.add( { attribute: [ 'title', 'name' ], class: [ 'foo', 'bar' ] );
 	 *
-	 * Throws {@link utils.CKEditorError CKEditorError} `viewconsumable-invalid-attribute` when `class` or `style`
+	 * Throws {@link utils.CKEditorError CKEditorError} `conversion-viewconsumable-invalid-attribute` when `class` or `style`
 	 * attribute is provided - it should be handled separately by providing `style` and `class` in consumables object.
 	 *
 	 * @param {Object} consumables Object describing which parts of the element can be consumed.
@@ -178,7 +178,7 @@ class ViewElementConsumables {
 	/**
 	 * Helper method that adds consumables of a given type: attribute, class or style.
 	 *
-	 * Throws {@link utils.CKEditorError CKEditorError} `viewconsumable-invalid-attribute` when `class` or `style`
+	 * Throws {@link utils.CKEditorError CKEditorError} `conversion-viewconsumable-invalid-attribute` when `class` or `style`
 	 * type is provided - it should be handled separately by providing actual style/class type.
 	 *
 	 * @private
@@ -196,7 +196,7 @@ class ViewElementConsumables {
 				 *
 				 * @error viewconsumable-invalid-attribute
 				 */
-				throw new CKEditorError( 'viewconsumable-invalid-attribute: Classes and styles should be handled separately.' );
+				throw new CKEditorError( 'conversion-viewconsumable-invalid-attribute: Classes and styles should be handled separately.' );
 			}
 
 			consumables.set( name, true );
@@ -343,7 +343,7 @@ export default class ViewConsumable {
 	 *		viewConsumable.add( textNode ); // Adds text node to consume.
 	 *		viewConsumable.add( docFragment ); // Adds document fragment to consume.
 	 *
-	 * Throws {@link utils.CKEditorError CKEditorError} `viewconsumable-invalid-attribute` when `class` or `style`
+	 * Throws {@link utils.CKEditorError CKEditorError} `conversion-viewconsumable-invalid-attribute` when `class` or `style`
 	 * attribute is provided - it should be handled separately by providing actual style/class.
 	 *
 	 *		viewConsumable.add( p, { attribute: 'style' } ); // This call will throw an exception.

+ 1 - 1
packages/ckeditor5-engine/src/model/batch.js

@@ -145,7 +145,7 @@ export function register( name, creator ) {
 		 * @param {String} name
 		 */
 		throw new CKEditorError(
-			'batch-register-taken: This batch method name is already taken.',
+			'model-batch-register-taken: This batch method name is already taken.',
 			{ name: name } );
 	}
 

+ 3 - 3
packages/ckeditor5-engine/src/model/document.js

@@ -142,7 +142,7 @@ export default class Document {
 			 * @param {engine.model.operation.Operation} operation
 			 */
 			throw new CKEditorError(
-				'document-applyOperation-wrong-version: Only operations with matching versions can be applied.',
+				'model-document-applyOperation-wrong-version: Only operations with matching versions can be applied.',
 				{ operation: operation } );
 		}
 
@@ -189,7 +189,7 @@ export default class Document {
 			 * @param {String} name
 			 */
 			throw new CKEditorError(
-				'document-createRoot-name-exists: Root with specified name already exists.',
+				'model-document-createRoot-name-exists: Root with specified name already exists.',
 				{ name: rootName }
 			);
 		}
@@ -247,7 +247,7 @@ export default class Document {
 			 * @param {String} name
 			 */
 			throw new CKEditorError(
-				'document-getRoot-root-not-exist: Root with specified name does not exist.',
+				'model-document-getRoot-root-not-exist: Root with specified name does not exist.',
 				{ name: name }
 			);
 		}

+ 1 - 1
packages/ckeditor5-engine/src/model/history.js

@@ -200,7 +200,7 @@ export default class History {
 			 *
 			 * @error history-wrong-version
 			 */
-			throw new CKEditorError( 'history-wrong-version: Given base version points to the middle of a delta.' );
+			throw new CKEditorError( 'model-history-wrong-version: Given base version points to the middle of a delta.' );
 		}
 
 		return index;

+ 1 - 1
packages/ckeditor5-engine/src/model/liveposition.js

@@ -40,7 +40,7 @@ export default class LivePosition extends Position {
 			 *
 			 * @error liveposition-root-not-rootelement
 			 */
-			throw new CKEditorError( 'liveposition-root-not-rootelement: LivePosition root has to be an instance of RootElement.' );
+			throw new CKEditorError( 'model-liveposition-root-not-rootelement: LivePosition root has to be an instance of RootElement.' );
 		}
 
 		super( root, path );

+ 2 - 2
packages/ckeditor5-engine/src/model/node.js

@@ -85,7 +85,7 @@ export default class Node {
 			 *
 			 * @error node-not-found-in-parent
 			 */
-			throw new CKEditorError( 'node-not-found-in-parent: The node\'s parent does not contain this node.' );
+			throw new CKEditorError( 'model-node-not-found-in-parent: The node\'s parent does not contain this node.' );
 		}
 
 		return pos;
@@ -114,7 +114,7 @@ export default class Node {
 			 *
 			 * @error node-not-found-in-parent
 			 */
-			throw new CKEditorError( 'node-not-found-in-parent: The node\'s parent does not contain this node.' );
+			throw new CKEditorError( 'model-node-not-found-in-parent: The node\'s parent does not contain this node.' );
 		}
 
 		return pos;

+ 5 - 5
packages/ckeditor5-engine/src/model/nodelist.js

@@ -98,7 +98,7 @@ export default class NodeList {
 	 * Converts index to offset in node list.
 	 *
 	 * Returns starting offset of a node that is at given index. Throws {@link utils.CKEditorError CKEditorError}
-	 * `nodelist-index-out-of-bounds` if given index is less than `0` or more than {@link engine.model.NodeList#length}.
+	 * `model-nodelist-index-out-of-bounds` if given index is less than `0` or more than {@link engine.model.NodeList#length}.
 	 *
 	 * @param {Number} index Node's index.
 	 * @returns {Number} Node's starting offset.
@@ -116,7 +116,7 @@ export default class NodeList {
 			 *
 			 * @error nodelist-index-out-of-bounds
 			 */
-			throw new CKEditorError( 'nodelist-index-out-of-bounds: Given index cannot be found in the node list.' );
+			throw new CKEditorError( 'model-nodelist-index-out-of-bounds: Given index cannot be found in the node list.' );
 		}
 
 		return this.getNodeStartOffset( node );
@@ -126,7 +126,7 @@ export default class NodeList {
 	 * Converts offset in node list to index.
 	 *
 	 * Returns index of a node that occupies given offset. Throws {@link utils.CKEditorError CKEditorError}
-	 * `nodelist-offset-out-of-bounds` if given offset is less than `0` or more than {@link engine.model.NodeList#getMaxOffset}.
+	 * `model-nodelist-offset-out-of-bounds` if given offset is less than `0` or more than {@link engine.model.NodeList#getMaxOffset}.
 	 *
 	 * @param {Number} offset Offset to look for.
 	 * @returns {Number} Index of a node that occupies given offset.
@@ -148,7 +148,7 @@ export default class NodeList {
 			 *
 			 * @error nodelist-offset-out-of-bounds
 			 */
-			throw new CKEditorError( 'nodelist-offset-out-of-bounds: Given offset cannot be found in the node list.' );
+			throw new CKEditorError( 'model-nodelist-offset-out-of-bounds: Given offset cannot be found in the node list.' );
 		}
 
 		return this.length;
@@ -169,7 +169,7 @@ export default class NodeList {
 				 *
 				 * @error nodelist-insertNodes-not-node
 				 */
-				throw new CKEditorError( 'nodelist-insertNodes-not-node: Trying to insert an object which is not a Node instance.' );
+				throw new CKEditorError( 'model-nodelist-insertNodes-not-node: Trying to insert an object which is not a Node instance.' );
 			}
 		}
 

+ 1 - 1
packages/ckeditor5-engine/src/model/operation/attributeoperation.js

@@ -115,7 +115,7 @@ export default class AttributeOperation extends Operation {
 				 * @param {String} key
 				 */
 				throw new CKEditorError(
-					'operation-attribute-wrong-old-value: Changed node has different attribute value than operation\'s old attribute value.',
+					'attribute-operation-wrong-old-value: Changed node has different attribute value than operation\'s old attribute value.',
 					{ item: item, key: this.key }
 				);
 			}

+ 6 - 6
packages/ckeditor5-engine/src/model/position.js

@@ -46,7 +46,7 @@ export default class Position {
 			 *
 			 * @error position-root-invalid.
 			 */
-			throw new CKEditorError( 'position-root-invalid: Position root invalid.' );
+			throw new CKEditorError( 'model-position-root-invalid: Position root invalid.' );
 		}
 
 		if ( !( path instanceof Array ) || path.length === 0 ) {
@@ -56,7 +56,7 @@ export default class Position {
 			 * @error position-path-incorrect
 			 * @param path
 			 */
-			throw new CKEditorError( 'position-path-incorrect: Position path must be an Array with at least one item.', { path: path } );
+			throw new CKEditorError( 'model-position-path-incorrect: Position path must be an Array with at least one item.', { path: path } );
 		}
 
 		// Normalize the root and path (if element was passed).
@@ -601,7 +601,7 @@ export default class Position {
 			 * @error position-after-root
 			 * @param {engine.model.Item} root
 			 */
-			throw new CKEditorError( 'position-after-root: You can not make position after root.', { root: item } );
+			throw new CKEditorError( 'model-position-after-root: You can not make position after root.', { root: item } );
 		}
 
 		return this.createFromParentAndOffset( item.parent, item.endOffset );
@@ -621,7 +621,7 @@ export default class Position {
 			 * @error position-before-root
 			 * @param {engine.model.Item} root
 			 */
-			throw new CKEditorError( 'position-before-root: You can not make position before root.', { root: item } );
+			throw new CKEditorError( 'model-position-before-root: You can not make position before root.', { root: item } );
 		}
 
 		return this.createFromParentAndOffset( item.parent, item.startOffset );
@@ -641,7 +641,7 @@ export default class Position {
 			 *
 			 * @error position-parent-incorrect
 			 */
-			throw new CKEditorError( 'position-parent-incorrect: Position parent have to be a element or document fragment.' );
+			throw new CKEditorError( 'model-position-parent-incorrect: Position parent have to be a element or document fragment.' );
 		}
 
 		const path = parent.getPath();
@@ -680,7 +680,7 @@ export default class Position {
 			 * @param {String} rootName
 			 */
 			throw new CKEditorError(
-				'position-fromjson-no-root: Cannot create position for document. Root with specified name does not exist.',
+				'model-position-fromjson-no-root: Cannot create position for document. Root with specified name does not exist.',
 				{ rootName: json.root }
 			);
 		}

+ 3 - 3
packages/ckeditor5-engine/src/model/schema.js

@@ -440,7 +440,7 @@ export default class Schema {
 			 *
 			 * @error schema-item-exists
 			 */
-			throw new CKEditorError( 'schema-item-exists: Item with specified name already exists in schema.' );
+			throw new CKEditorError( 'model-schema-item-exists: Item with specified name already exists in schema.' );
 		}
 
 		if ( !!isExtending && !this.hasItem( isExtending ) ) {
@@ -449,7 +449,7 @@ export default class Schema {
 			 *
 			 * @error schema-no-item
 			 */
-			throw new CKEditorError( 'schema-no-item: Item with specified name does not exist in schema.' );
+			throw new CKEditorError( 'model-schema-no-item: Item with specified name does not exist in schema.' );
 		}
 
 		// Create new SchemaItem and add it to the items store.
@@ -479,7 +479,7 @@ export default class Schema {
 			 *
 			 * @error schema-no-item
 			 */
-			throw new CKEditorError( 'schema-no-item: Item with specified name does not exist in schema.' );
+			throw new CKEditorError( 'model-schema-no-item: Item with specified name does not exist in schema.' );
 		}
 
 		return this._items.get( itemName );

+ 3 - 3
packages/ckeditor5-engine/src/model/selection.js

@@ -443,7 +443,7 @@ export default class Selection {
 			 *
 			 * @error selection-setFocus-no-ranges
 			 */
-			throw new CKEditorError( 'selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.' );
+			throw new CKEditorError( 'model-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.' );
 		}
 
 		const newFocus = Position.createAt( itemOrPosition, offset );
@@ -488,7 +488,7 @@ export default class Selection {
 	 */
 	_pushRange( range ) {
 		if ( !( range instanceof Range ) ) {
-			throw new CKEditorError( 'selection-added-not-range: Trying to add an object that is not an instance of Range.' );
+			throw new CKEditorError( 'model-selection-added-not-range: Trying to add an object that is not an instance of Range.' );
 		}
 
 		this._checkRange( range );
@@ -512,7 +512,7 @@ export default class Selection {
 				 * @param {engine.model.Range} intersectingRange Range from selection that intersects with `addedRange`.
 				 */
 				throw new CKEditorError(
-					'selection-range-intersects: Trying to add a range that intersects with another range from selection.',
+					'model-selection-range-intersects: Trying to add a range that intersects with another range from selection.',
 					{ addedRange: range, intersectingRange: this._ranges[ i ] }
 				);
 			}

+ 2 - 2
packages/ckeditor5-engine/src/model/treewalker.js

@@ -40,14 +40,14 @@ export default class TreeWalker {
 			 *
 			 * @error tree-walker-no-start-position
 			 */
-			throw new CKEditorError( 'tree-walker-no-start-position: Neither boundaries nor starting position have been defined.' );
+			throw new CKEditorError( 'model-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.' );
 		}
 
 		const direction = options.direction || 'forward';
 
 		if ( direction != 'forward' && direction != 'backward' ) {
 			throw new CKEditorError(
-				'tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.',
+				'model-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.',
 				{ direction }
 			);
 		}

+ 2 - 2
packages/ckeditor5-engine/src/view/position.js

@@ -304,7 +304,7 @@ export default class Position {
 			 * @error position-after-root
 			 * @param {engine.view.Node} root
 			 */
-			throw new CKEditorError( 'position-after-root: You can not make position after root.', { root: item } );
+			throw new CKEditorError( 'view-position-after-root: You can not make position after root.', { root: item } );
 		}
 
 		return new Position( item.parent, item.index + 1 );
@@ -329,7 +329,7 @@ export default class Position {
 			 * @error position-before-root
 			 * @param {engine.view.Node} root
 			 */
-			throw new CKEditorError( 'position-before-root: You can not make position before root.', { root: item } );
+			throw new CKEditorError( 'view-position-before-root: You can not make position before root.', { root: item } );
 		}
 
 		return new Position( item.parent, item.index );

+ 2 - 2
packages/ckeditor5-engine/src/view/renderer.js

@@ -137,7 +137,7 @@ export default class Renderer {
 				 *
 				 * @error renderer-unknown-type
 				 */
-				throw new CKEditorError( 'renderer-unknown-type: Unknown type passed to Renderer.markToSync.' );
+				throw new CKEditorError( 'view-renderer-unknown-type: Unknown type passed to Renderer.markToSync.' );
 			}
 		}
 	}
@@ -254,7 +254,7 @@ export default class Renderer {
 			 *
 			 * @error renderer-render-no-inline-filler.
 			 */
-			throw new CKEditorError( 'renderer-render-no-inline-filler: No inline filler on expected position.' );
+			throw new CKEditorError( 'view-renderer-render-no-inline-filler: No inline filler on expected position.' );
 		}
 
 		if ( isInlineFiller( domFillerNode ) ) {

+ 5 - 5
packages/ckeditor5-engine/src/view/selection.js

@@ -134,7 +134,7 @@ export default class Selection {
 	 * The flag is used to set {@link engine.view.Selection#anchor anchor} and
 	 * {@link engine.view.Selection#focus focus} properties.
 	 *
-	 * Throws {@link utils.CKEditorError CKEditorError} `selection-range-intersects` if added range intersects
+	 * Throws {@link utils.CKEditorError CKEditorError} `view-selection-range-intersects` if added range intersects
 	 * with ranges already stored in Selection instance.
 	 *
 	 * @fires engine.view.Selection#change
@@ -142,7 +142,7 @@ export default class Selection {
 	 */
 	addRange( range, isBackward ) {
 		if ( !( range instanceof Range ) ) {
-			throw new CKEditorError( 'selection-invalid-range: Invalid Range.' );
+			throw new CKEditorError( 'view-selection-invalid-range: Invalid Range.' );
 		}
 
 		this._pushRange( range );
@@ -276,7 +276,7 @@ export default class Selection {
 
 		for ( let range of newRanges ) {
 			if ( !( range instanceof Range ) ) {
-				throw new CKEditorError( 'selection-invalid-range: Invalid Range.' );
+				throw new CKEditorError( 'view-selection-invalid-range: Invalid Range.' );
 			}
 
 			this._pushRange( range );
@@ -359,7 +359,7 @@ export default class Selection {
 	/**
 	 * Adds range to selection - creates copy of given range so it can be safely used and modified.
 	 *
-	 * Throws {@link utils.CKEditorError CKEditorError} `selection-range-intersects` if added range intersects
+	 * Throws {@link utils.CKEditorError CKEditorError} `view-selection-range-intersects` if added range intersects
 	 * with ranges already stored in selection instance.
 	 *
 	 * @private
@@ -376,7 +376,7 @@ export default class Selection {
 				 * @param {engine.view.Range} intersectingRange Range from selection that intersects with `addedRange`.
 				 */
 				throw new CKEditorError(
-					'selection-range-intersects: Trying to add a range that intersects with another range from selection.',
+					'view-selection-range-intersects: Trying to add a range that intersects with another range from selection.',
 					{ addedRange: range, intersectingRange: storedRange }
 				);
 			}

+ 2 - 2
packages/ckeditor5-engine/src/view/treewalker.js

@@ -40,12 +40,12 @@ export default class TreeWalker {
 			 *
 			 * @error tree-walker-no-start-position
 			 */
-			throw new CKEditorError( 'tree-walker-no-start-position: Neither boundaries nor starting position have been defined.' );
+			throw new CKEditorError( 'view-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.' );
 		}
 
 		if ( options.direction && options.direction != 'forward' && options.direction != 'backward' ) {
 			throw new CKEditorError(
-				'tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.',
+				'view-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.',
 				{ direction: options.direction }
 			);
 		}