Skip to content

Commit 6f07d5d

Browse files
committed
Merge branch 't/13730'
2 parents 47e6f7f + fec0b25 commit 6f07d5d

File tree

13 files changed

+33
-68
lines changed

13 files changed

+33
-68
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CKEditor 4 Changelog
66
New Features:
77

88
* [#13632](http://dev.ckeditor.com/ticket/13632): Introduce error logging mechanism.
9+
* [#13730](http://dev.ckeditor.com/ticket/13730): Switch to the new error logging mechanism.
910

1011
Fixed Issues:
1112

core/dom/range.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2714,9 +2714,7 @@ CKEDITOR.dom.range = function( root ) {
27142714
var isRootAscendantOrSelf = this.root.equals( startContainer ) || this.root.contains( startContainer );
27152715

27162716
if ( !isRootAscendantOrSelf ) {
2717-
window.console && console.log && console.log( // jshint ignore:line
2718-
'[CKEDITOR.dom.range.setStart] Element', startContainer, 'is not a descendant of root', this.root
2719-
);
2717+
CKEDITOR.warn( 'range-startcontainer', { startContainer: startContainer, root: this.root } );
27202718
}
27212719
// %REMOVE_END%
27222720
this.startContainer = startContainer;
@@ -2734,9 +2732,7 @@ CKEDITOR.dom.range = function( root ) {
27342732
var isRootAscendantOrSelf = this.root.equals( endContainer ) || this.root.contains( endContainer );
27352733

27362734
if ( !isRootAscendantOrSelf ) {
2737-
window.console && console.log && console.log( // jshint ignore:line
2738-
'[CKEDITOR.dom.range.setEnd] Element', endContainer, 'is not a descendant of root', this.root
2739-
);
2735+
CKEDITOR.warn( 'range-endcontainer', { endContainer: endContainer, root: this.root } );
27402736
}
27412737
// %REMOVE_END%
27422738
this.endContainer = endContainer;

core/editor.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,7 @@
545545

546546
if ( requires && ( match = requires.match( removeRegex ) ) ) {
547547
while ( ( name = match.pop() ) ) {
548-
CKEDITOR.tools.setTimeout( function( name, pluginName ) {
549-
throw new Error( 'Plugin "' + name.replace( ',', '' ) + '" cannot be removed from the plugins list, because it\'s required by "' + pluginName + '" plugin.' );
550-
}, 0, null, [ name, pluginName ] );
548+
CKEDITOR.error( 'editor-plugin-required', { plugin: name.replace( ',', '' ), requiredBy: pluginName } );
551549
}
552550
}
553551

core/log.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,5 @@ CKEDITOR.on( 'log', function( evt ) {
121121
console[ type ]( prefix + errorCode );
122122
}
123123

124-
// TODO: Add proper info and documentation url.
125-
console[ type ]( prefix + 'For more information go to http://docs.ckeditor.com/' );
124+
console[ type ]( prefix + 'For more information go to http://docs.ckeditor.com/#!/guide/dev_errors-section-' + errorCode );
126125
}, null, null, 999 );

core/resourcemanager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ CKEDITOR.resourceManager.prototype = {
7171
*/
7272
add: function( name, definition ) {
7373
if ( this.registered[ name ] )
74-
throw '[CKEDITOR.resourceManager.add] The resource name "' + name + '" is already registered.';
74+
throw new Error( '[CKEDITOR.resourceManager.add] The resource name "' + name + '" is already registered.' );
7575

7676
var resource = this.registered[ name ] = definition || {};
7777
resource.name = name;
@@ -208,8 +208,8 @@ CKEDITOR.resourceManager.prototype = {
208208

209209
CKEDITOR.scriptLoader.load( urls, function( completed, failed ) {
210210
if ( failed.length ) {
211-
throw '[CKEDITOR.resourceManager.load] Resource name "' + urlsNames[ failed[ 0 ] ].join( ',' ) +
212-
'" was not found at "' + failed[ 0 ] + '".';
211+
throw new Error( '[CKEDITOR.resourceManager.load] Resource name "' + urlsNames[ failed[ 0 ] ].join( ',' ) +
212+
'" was not found at "' + failed[ 0 ] + '".' );
213213
}
214214

215215
for ( var i = 0; i < completed.length; i++ ) {

core/selection.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,11 +1669,9 @@
16691669

16701670
removeHiddenSelectionContainer( editor );
16711671
}
1672-
// jshint ignore:start
1673-
else { // %REMOVE_LINE%
1674-
window.console && console.log( '[CKEDITOR.dom.selection.reset] Wrong selection instance resets fake selection.' ); // %REMOVE_LINE%
1675-
} // %REMOVE_LINE%
1676-
// jshint ignore:end
1672+
else {
1673+
CKEDITOR.warn( 'selection-fake-reset' );
1674+
}
16771675
}
16781676

16791677
this.rev = nextRev++;
@@ -2066,9 +2064,7 @@
20662064
if ( bookmarks.isFake ) {
20672065
node = ranges[ 0 ].getEnclosedNode();
20682066
if ( !node || node.type != CKEDITOR.NODE_ELEMENT ) {
2069-
// %REMOVE_START%
2070-
window.console && console.log( '[CKEDITOR.dom.selection.selectBookmarks] Selection is no longer fake.' ); // jshint ignore:line
2071-
// %REMOVE_END%
2067+
CKEDITOR.warn( 'selection-not-fake' );
20722068
bookmarks.isFake = 0;
20732069
}
20742070
}

plugins/autoembed/plugin.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@
5757
widgetDef = CKEDITOR.plugins.autoEmbed.getWidgetDefinition( editor, href );
5858

5959
if ( !widgetDef ) {
60-
window.console && window.console.log(
61-
'[CKEDITOR.plugins.autoEmbed] Incorrect config.autoEmbed_widget value. ' +
62-
'No widget definition found.'
63-
);
60+
CKEDITOR.warn( 'autoembed-no-widget-def' );
6461
return;
6562
}
6663

plugins/embedbase/plugin.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,7 @@
218218

219219
// Check if widget is still valid.
220220
if ( !that.editor.widgets.instances[ that.id ] ) {
221-
// %REMOVE_START%
222-
window.console && console.log && console.log( // jshint ignore:line
223-
'[CKEDITOR.plugins.embedBase.baseDefinition.loadContent] Widget no longer belongs to current editor\'s widgets list.'
224-
);
225-
// %REMOVE_END%
221+
CKEDITOR.warn( 'embedbase-widget-invalid' );
226222

227223
if ( request.task ) {
228224
request.task.done();

plugins/filetools/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
} catch ( err ) {
8989
// Response parsing error.
9090
data.message = fileLoader.lang.filetools.responseError;
91-
window.console && window.console.log( xhr.responseText );
91+
CKEDITOR.warn( 'filetools-response-error', { responseText: xhr.responseText } );
9292

9393
evt.cancel();
9494
}

plugins/mathjax/plugin.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
hidpi: true, // %REMOVE_LINE_CORE%
1818

1919
init: function( editor ) {
20-
var cls = editor.config.mathJaxClass || 'math-tex',
21-
docsUrl = 'http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-mathJaxLib';
20+
var cls = editor.config.mathJaxClass || 'math-tex';
2221

23-
if ( !editor.config.mathJaxLib && ( window.console && window.console.log ) ) {
24-
window.console.log( 'Error: config.mathJaxLib property is not set. For more information visit: ', docsUrl );
22+
if ( !editor.config.mathJaxLib ) {
23+
CKEDITOR.error( 'mathjax-no-config' );
2524
}
2625

2726
editor.widgets.add( 'mathjax', {

0 commit comments

Comments
 (0)