Ver Fonte

Fix CKEditorError documentation.

Maciej Gołaszewski há 5 anos atrás
pai
commit
14007d342b

+ 1 - 1
packages/ckeditor5-table/src/tablewalker.js

@@ -532,7 +532,7 @@ class TableSlot {
  */
 
 // @if CK_DEBUG // function throwMissingGetterError( getterName ) {
-// @if CK_DEBUG //		throw new CKEditorError( 'tableslot-getter-removed: This TableSlot getter does not exist anymore.', this, {
+// @if CK_DEBUG //		throw new CKEditorError( 'tableslot-getter-removed', this, {
 // @if CK_DEBUG //			getterName
 // @if CK_DEBUG //		} );
 // @if CK_DEBUG // }

+ 8 - 9
packages/ckeditor5-utils/src/ckeditorerror.js

@@ -33,7 +33,7 @@ export const DOCUMENTATION_URL =
  *		 * @param pluginName The name of the plugin that could not be loaded.
  *		 * @param moduleName The name of the module which tried to load this plugin.
  *		 * /
- *		throw new CKEditorError( 'plugin-load: It was not possible to load the "{$pluginName}" plugin in module "{$moduleName}', {
+ *		throw new CKEditorError( 'plugin-load', {
  *			pluginName: 'foo',
  *			moduleName: 'bar'
  *		} );
@@ -44,9 +44,8 @@ export default class CKEditorError extends Error {
 	/**
 	 * Creates an instance of the CKEditorError class.
 	 *
-	 * @param {String} message The error message in an `error-name: Error message.` format.
-	 * During the minification process the "Error message" part will be removed to limit the code size
-	 * and a link to this error documentation will be added to the `message`.
+	 * @param {String} errorName The error id in an `error-name` format. A link to this error documentation page will be added
+	 * to the thrown error's `message`.
 	 * @param {Object|null} context A context of the error by which the {@link module:watchdog/watchdog~Watchdog watchdog}
 	 * is able to determine which editor crashed. It should be an editor instance or a property connected to it. It can be also
 	 * a `null` value if the editor should not be restarted in case of the error (e.g. during the editor initialization).
@@ -56,8 +55,8 @@ export default class CKEditorError extends Error {
 	 * will be appended to the error message, so the data are quickly visible in the console. The original
 	 * data object will also be later available under the {@link #data} property.
 	 */
-	constructor( message, context, data ) {
-		message = attachLinkToDocumentation( message );
+	constructor( errorName, context, data ) {
+		let message = attachLinkToDocumentation( errorName );
 
 		if ( data ) {
 			message += ' ' + JSON.stringify( data );
@@ -138,9 +137,9 @@ export default class CKEditorError extends Error {
  *		  * /
  *		 console.warn( attachLinkToDocumentation( 'toolbarview-item-unavailable' ), { name } );
  *
- * @param {String} id Error id to be linked.
+ * @param {String} errorName Error name to be linked.
  * @returns {String}
  */
-export function attachLinkToDocumentation( id ) {
-	return id + ` Read more: ${ DOCUMENTATION_URL }#error-${ id }\n`;
+export function attachLinkToDocumentation( errorName ) {
+	return errorName + ` Read more: ${ DOCUMENTATION_URL }#error-${ errorName }\n`;
 }