Browse Source

Add error data to the error message, to make the message more useful.

Piotrek Koszuliński 10 years ago
parent
commit
aba17888e3
1 changed files with 7 additions and 1 deletions
  1. 7 1
      packages/ckeditor5-ui/src/ckeditorerror.js

+ 7 - 1
packages/ckeditor5-ui/src/ckeditorerror.js

@@ -28,9 +28,15 @@ CKEDITOR.define( function() {
 		 * @param {String} message The error message in an `error-name: Error message.` format.
 		 * @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
 		 * 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`.
 		 * and a link to this error documentation will be added to the `message`.
-		 * @param {Object} [data] Additional data describing the error.
+		 * @param {Object} [data] Additional data describing the error. A stringified version of this object
+		 * will be appended to the error {@link #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, data ) {
 		constructor( message, data ) {
+			if ( data ) {
+				message += ' ' + JSON.stringify( data );
+			}
+
 			super( message );
 			super( message );
 
 
 			this.name = 'CKEditorError';
 			this.name = 'CKEditorError';