@ckeditor/ckeditor5-utils
Advanced tools
Comparing version 30.0.0 to 31.0.0
{ | ||
"name": "@ckeditor/ckeditor5-utils", | ||
"version": "30.0.0", | ||
"version": "31.0.0", | ||
"description": "Miscellaneous utilities used by CKEditor 5.", | ||
@@ -17,6 +17,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-build-classic": "^30.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^30.0.0", | ||
"@ckeditor/ckeditor5-core": "^30.0.0", | ||
"@ckeditor/ckeditor5-engine": "^30.0.0", | ||
"@ckeditor/ckeditor5-build-classic": "^31.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^31.0.0", | ||
"@ckeditor/ckeditor5-core": "^31.0.0", | ||
"@ckeditor/ckeditor5-engine": "^31.0.0", | ||
"assertion-error": "^1.1.0", | ||
@@ -23,0 +23,0 @@ "js-beautify": "^1.11.0" |
@@ -62,6 +62,4 @@ /** | ||
constructor( errorName, context, data ) { | ||
const message = `${ errorName }${ ( data ? ` ${ JSON.stringify( data ) }` : '' ) }${ getLinkToDocumentationMessage( errorName ) }`; | ||
super( getErrorMessage( errorName, data ) ); | ||
super( message ); | ||
/** | ||
@@ -176,2 +174,7 @@ * @type {String} | ||
// Returns formatted link to documentation message. | ||
// | ||
// @private | ||
// @param {String} errorName | ||
// @returns {string} | ||
function getLinkToDocumentationMessage( errorName ) { | ||
@@ -181,2 +184,34 @@ return `\nRead more: ${ DOCUMENTATION_URL }#error-${ errorName }`; | ||
// Returns formatted error message. | ||
// | ||
// @private | ||
// @param {String} errorName | ||
// @param {Object} [data] | ||
// @returns {string} | ||
function getErrorMessage( errorName, data ) { | ||
const processedObjects = new WeakSet(); | ||
const circularReferencesReplacer = ( key, value ) => { | ||
if ( typeof value === 'object' && value !== null ) { | ||
if ( processedObjects.has( value ) ) { | ||
return `[object ${ value.constructor.name }]`; | ||
} | ||
processedObjects.add( value ); | ||
} | ||
return value; | ||
}; | ||
const stringifiedData = data ? ` ${ JSON.stringify( data, circularReferencesReplacer ) }` : ''; | ||
const documentationLink = getLinkToDocumentationMessage( errorName ); | ||
return errorName + stringifiedData + documentationLink; | ||
} | ||
// Returns formatted console error arguments. | ||
// | ||
// @private | ||
// @param {String} errorName | ||
// @param {Object} [data] | ||
// @returns {Array} | ||
function formatConsoleArguments( errorName, data ) { | ||
@@ -183,0 +218,0 @@ const documentationMessage = getLinkToDocumentationMessage( errorName ); |
@@ -14,3 +14,3 @@ /** | ||
const version = '30.0.0'; | ||
const version = '31.0.0'; | ||
@@ -17,0 +17,0 @@ export default version; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
258498
6868