DEV: Print error when decorateWidget target does not exist (#24026)

This commit is contained in:
David Taylor 2023-10-19 23:26:30 +01:00 committed by GitHub
parent a10a82131a
commit 10cd0e5531
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -41,7 +41,14 @@ export function deleteFromRegistry(name) {
const _decorators = {};
export function decorateWidget(widgetName, cb) {
_decorators[widgetName] = _decorators[widgetName] || [];
if (!_registry[name]) {
// eslint-disable-next-line no-console
console.error(
consolePrefix(),
`decorateWidget: Could not find widget '${name}' in registry`
);
}
_decorators[widgetName] ??= [];
_decorators[widgetName].push(cb);
}