Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge af8ae8f into c74c3d6
Browse files Browse the repository at this point in the history
  • Loading branch information
ma2ciek committed Jul 2, 2019
2 parents c74c3d6 + af8ae8f commit fdd5da4
Show file tree
Hide file tree
Showing 86 changed files with 842 additions and 726 deletions.
8 changes: 4 additions & 4 deletions src/controller/datacontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default class DataController {
*
* @error datacontroller-get-non-existent-root
*/
throw new CKEditorError( 'datacontroller-get-non-existent-root: Attempting to get data from a non-existing root.' );
throw new CKEditorError( 'datacontroller-get-non-existent-root: Attempting to get data from a non-existing root.', this );
}

const root = this.model.document.getRoot( rootName );
Expand Down Expand Up @@ -240,7 +240,7 @@ export default class DataController {
*
* @error datacontroller-init-document-not-empty
*/
throw new CKEditorError( 'datacontroller-init-document-not-empty: Trying to set initial data to not empty document.' );
throw new CKEditorError( 'datacontroller-init-document-not-empty: Trying to set initial data to not empty document.', this );
}

let initialData = {};
Expand All @@ -262,7 +262,7 @@ export default class DataController {
*
* @error datacontroller-init-non-existent-root
*/
throw new CKEditorError( 'datacontroller-init-non-existent-root: Attempting to init data on a non-existing root.' );
throw new CKEditorError( 'datacontroller-init-non-existent-root: Attempting to init data on a non-existing root.', this );
}

this.model.enqueueChange( 'transparent', writer => {
Expand Down Expand Up @@ -316,7 +316,7 @@ export default class DataController {
*
* @error datacontroller-set-non-existent-root
*/
throw new CKEditorError( 'datacontroller-set-non-existent-root: Attempting to set data on a non-existing root.' );
throw new CKEditorError( 'datacontroller-set-non-existent-root: Attempting to set data on a non-existing root.', this );
}

this.model.enqueueChange( 'transparent', writer => {
Expand Down
11 changes: 7 additions & 4 deletions src/conversion/conversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ export default class Conversion {
*
* @error conversion-add-alias-dispatcher-not-registered
*/
throw new CKEditorError( 'conversion-add-alias-dispatcher-not-registered: ' +
'Trying to register and alias for a dispatcher that nas not been registered.' );
throw new CKEditorError(
'conversion-add-alias-dispatcher-not-registered: ' +
'Trying to register and alias for a dispatcher that nas not been registered.',
this
);
}

this._createConversionHelpers( { name: alias, dispatchers: [ dispatcher ], isDowncast } );
Expand Down Expand Up @@ -180,7 +183,7 @@ export default class Conversion {
*
* @error conversion-for-unknown-group
*/
throw new CKEditorError( 'conversion-for-unknown-group: Trying to add a converter to an unknown dispatchers group.' );
throw new CKEditorError( 'conversion-for-unknown-group: Trying to add a converter to an unknown dispatchers group.', this );
}

return this._helpers.get( groupName );
Expand Down Expand Up @@ -585,7 +588,7 @@ export default class Conversion {
*
* @error conversion-group-exists
*/
throw new CKEditorError( 'conversion-group-exists: Trying to register a group name that has already been registered.' );
throw new CKEditorError( 'conversion-group-exists: Trying to register a group name that has already been registered.', this );
}

const helpers = isDowncast ? new DowncastHelpers( dispatchers ) : new UpcastHelpers( dispatchers );
Expand Down
2 changes: 1 addition & 1 deletion src/conversion/upcastdispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export default class UpcastDispatcher {
*
* @error view-conversion-dispatcher-incorrect-result
*/
throw new CKEditorError( 'view-conversion-dispatcher-incorrect-result: Incorrect conversion result was dropped.' );
throw new CKEditorError( 'view-conversion-dispatcher-incorrect-result: Incorrect conversion result was dropped.', this );
}

return { modelRange: data.modelRange, modelCursor: data.modelCursor };
Expand Down
2 changes: 1 addition & 1 deletion src/conversion/viewconsumable.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ class ViewElementConsumables {
*
* @error viewconsumable-invalid-attribute
*/
throw new CKEditorError( 'viewconsumable-invalid-attribute: Classes and styles should be handled separately.' );
throw new CKEditorError( 'viewconsumable-invalid-attribute: Classes and styles should be handled separately.', this );
}

consumables.set( name, true );
Expand Down
2 changes: 2 additions & 0 deletions src/model/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export default class Document {
*/
throw new CKEditorError(
'model-document-applyOperation-wrong-version: Only operations with matching versions can be applied.',
this,
{ operation }
);
}
Expand Down Expand Up @@ -201,6 +202,7 @@ export default class Document {
*/
throw new CKEditorError(
'model-document-createRoot-name-exists: Root with specified name already exists.',
this,
{ name: rootName }
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/model/documentselection.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ class LiveSelection extends Selection {
*/
throw new CKEditorError(
'document-selection-wrong-position: Range from document selection starts or ends at incorrect position.',
this,
{ range }
);
}
Expand Down Expand Up @@ -767,6 +768,7 @@ class LiveSelection extends Selection {
*/
throw new CKEditorError(
'document-selection-gravity-wrong-restore: Attempting to restore the selection gravity for an unknown UID.',
this,
{ uid }
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/model/liveposition.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export default class LivePosition extends Position {
* @error liveposition-root-not-rootelement
*/
throw new CKEditorError(
'model-liveposition-root-not-rootelement: LivePosition\'s root has to be an instance of RootElement.'
'model-liveposition-root-not-rootelement: LivePosition\'s root has to be an instance of RootElement.',
root
);
}

Expand Down
12 changes: 6 additions & 6 deletions src/model/markercollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default class MarkerCollection {
const marker = this._markers.get( markerName );

if ( !marker ) {
throw new CKEditorError( 'markercollection-refresh-marker-not-exists: Marker with provided name does not exists.' );
throw new CKEditorError( 'markercollection-refresh-marker-not-exists: Marker with provided name does not exists.', this );
}

const range = marker.getRange();
Expand Down Expand Up @@ -383,7 +383,7 @@ class Marker {
*/
get managedUsingOperations() {
if ( !this._liveRange ) {
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.' );
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.', this );
}

return this._managedUsingOperations;
Expand All @@ -396,7 +396,7 @@ class Marker {
*/
get affectsData() {
if ( !this._liveRange ) {
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.' );
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.', this );
}

return this._affectsData;
Expand All @@ -409,7 +409,7 @@ class Marker {
*/
getStart() {
if ( !this._liveRange ) {
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.' );
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.', this );
}

return this._liveRange.start.clone();
Expand All @@ -422,7 +422,7 @@ class Marker {
*/
getEnd() {
if ( !this._liveRange ) {
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.' );
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.', this );
}

return this._liveRange.end.clone();
Expand All @@ -442,7 +442,7 @@ class Marker {
*/
getRange() {
if ( !this._liveRange ) {
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.' );
throw new CKEditorError( 'marker-destroyed: Cannot use a destroyed marker instance.', this );
}

return this._liveRange.toRange();
Expand Down
4 changes: 2 additions & 2 deletions src/model/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default class Node {
}

if ( ( pos = this.parent.getChildIndex( this ) ) === null ) {
throw new CKEditorError( 'model-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.', this );
}

return pos;
Expand All @@ -112,7 +112,7 @@ export default class Node {
}

if ( ( pos = this.parent.getChildStartOffset( this ) ) === null ) {
throw new CKEditorError( 'model-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.', this );
}

return pos;
Expand Down
18 changes: 12 additions & 6 deletions src/model/nodelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default class NodeList {
*
* @error nodelist-index-out-of-bounds
*/
throw new CKEditorError( 'model-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.', this );
}

return this.getNodeStartOffset( node );
Expand Down Expand Up @@ -158,10 +158,13 @@ export default class NodeList {
* @param {Number} offset
* @param {module:engine/model/nodelist~NodeList} nodeList Stringified node list.
*/
throw new CKEditorError( 'model-nodelist-offset-out-of-bounds: Given offset cannot be found in the node list.', {
offset,
nodeList: this
} );
throw new CKEditorError( 'model-nodelist-offset-out-of-bounds: Given offset cannot be found in the node list.',
this,
{
offset,
nodeList: this
}
);
}

return this.length;
Expand All @@ -183,7 +186,10 @@ export default class NodeList {
*
* @error nodelist-insertNodes-not-node
*/
throw new CKEditorError( 'model-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.',
this
);
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/model/operation/attributeoperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default class AttributeOperation extends Operation {
*
* @error attribute-operation-range-not-flat
*/
throw new CKEditorError( 'attribute-operation-range-not-flat: The range to change is not flat.' );
throw new CKEditorError( 'attribute-operation-range-not-flat: The range to change is not flat.', this );
}

for ( const item of this.range.getItems( { shallow: true } ) ) {
Expand All @@ -144,6 +144,7 @@ export default class AttributeOperation extends Operation {
throw new CKEditorError(
'attribute-operation-wrong-old-value: Changed node has different attribute value than operation\'s ' +
'old attribute value.',
this,
{ item, key: this.key, value: this.oldValue }
);
}
Expand All @@ -158,6 +159,7 @@ export default class AttributeOperation extends Operation {
*/
throw new CKEditorError(
'attribute-operation-attribute-exists: The attribute with given key already exists.',
this,
{ node: item, key: this.key }
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/model/operation/detachoperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class DetachOperation extends Operation {
*
* @error detach-operation-on-document-node
*/
throw new CKEditorError( 'detach-operation-on-document-node: Cannot detach document node.' );
throw new CKEditorError( 'detach-operation-on-document-node: Cannot detach document node.', this );
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/model/operation/insertoperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ export default class InsertOperation extends Operation {
* @error insert-operation-position-invalid
*/
throw new CKEditorError(
'insert-operation-position-invalid: Insertion position is invalid.'
'insert-operation-position-invalid: Insertion position is invalid.',
this
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/model/operation/mergeoperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,21 @@ export default class MergeOperation extends Operation {
*
* @error merge-operation-source-position-invalid
*/
throw new CKEditorError( 'merge-operation-source-position-invalid: Merge source position is invalid.' );
throw new CKEditorError( 'merge-operation-source-position-invalid: Merge source position is invalid.', this );
} else if ( !targetElement || !targetElement.is( 'element' ) || !targetElement.parent ) {
/**
* Merge target position is invalid.
*
* @error merge-operation-target-position-invalid
*/
throw new CKEditorError( 'merge-operation-target-position-invalid: Merge target position is invalid.' );
throw new CKEditorError( 'merge-operation-target-position-invalid: Merge target position is invalid.', this );
} else if ( this.howMany != sourceElement.maxOffset ) {
/**
* Merge operation specifies wrong number of nodes to move.
*
* @error merge-operation-how-many-invalid
*/
throw new CKEditorError( 'merge-operation-how-many-invalid: Merge operation specifies wrong number of nodes to move.' );
throw new CKEditorError( 'merge-operation-how-many-invalid: Merge operation specifies wrong number of nodes to move.', this );
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/model/operation/moveoperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default class MoveOperation extends Operation {
* @error move-operation-position-invalid
*/
throw new CKEditorError(
'move-operation-position-invalid: Source position or target position is invalid.'
'move-operation-position-invalid: Source position or target position is invalid.', this
);
} else if ( sourceOffset + this.howMany > sourceElement.maxOffset ) {
/**
Expand All @@ -139,7 +139,7 @@ export default class MoveOperation extends Operation {
* @error move-operation-nodes-do-not-exist
*/
throw new CKEditorError(
'move-operation-nodes-do-not-exist: The nodes which should be moved do not exist.'
'move-operation-nodes-do-not-exist: The nodes which should be moved do not exist.', this
);
} else if ( sourceElement === targetElement && sourceOffset < targetOffset && targetOffset < sourceOffset + this.howMany ) {
/**
Expand All @@ -148,7 +148,7 @@ export default class MoveOperation extends Operation {
* @error move-operation-range-into-itself
*/
throw new CKEditorError(
'move-operation-range-into-itself: Trying to move a range of nodes to the inside of that range.'
'move-operation-range-into-itself: Trying to move a range of nodes to the inside of that range.', this
);
} else if ( this.sourcePosition.root == this.targetPosition.root ) {
if ( compareArrays( this.sourcePosition.getParentPath(), this.targetPosition.getParentPath() ) == 'prefix' ) {
Expand All @@ -161,7 +161,7 @@ export default class MoveOperation extends Operation {
* @error move-operation-node-into-itself
*/
throw new CKEditorError(
'move-operation-node-into-itself: Trying to move a range of nodes into one of nodes from that range.'
'move-operation-node-into-itself: Trying to move a range of nodes into one of nodes from that range.', this
);
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/model/operation/renameoperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export default class RenameOperation extends Operation {
* @error rename-operation-wrong-position
*/
throw new CKEditorError(
'rename-operation-wrong-position: Given position is invalid or node after it is not an instance of Element.'
'rename-operation-wrong-position: Given position is invalid or node after it is not an instance of Element.',
this
);
} else if ( element.name !== this.oldName ) {
/**
Expand All @@ -103,7 +104,8 @@ export default class RenameOperation extends Operation {
* @error rename-operation-wrong-name
*/
throw new CKEditorError(
'rename-operation-wrong-name: Element to change has different name than operation\'s old name.'
'rename-operation-wrong-name: Element to change has different name than operation\'s old name.',
this
);
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/model/operation/rootattributeoperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export default class RootAttributeOperation extends Operation {
*/
throw new CKEditorError(
'rootattribute-operation-not-a-root: The element to change is not a root element.',
this,
{ root: this.root, key: this.key }
);
}
Expand All @@ -132,6 +133,7 @@ export default class RootAttributeOperation extends Operation {
throw new CKEditorError(
'rootattribute-operation-wrong-old-value: Changed node has different attribute value than operation\'s ' +
'old attribute value.',
this,
{ root: this.root, key: this.key }
);
}
Expand All @@ -146,6 +148,7 @@ export default class RootAttributeOperation extends Operation {
*/
throw new CKEditorError(
'rootattribute-operation-attribute-exists: The attribute with given key already exists.',
this,
{ root: this.root, key: this.key }
);
}
Expand Down Expand Up @@ -197,6 +200,7 @@ export default class RootAttributeOperation extends Operation {
*/
throw new CKEditorError(
'rootattribute-operation-fromjson-no-root: Cannot create RootAttributeOperation. Root with specified name does not exist.',
this,
{ rootName: json.root }
);
}
Expand Down
Loading

0 comments on commit fdd5da4

Please sign in to comment.