diff --git a/src/static/js/pluginfw/hooks.js b/src/static/js/pluginfw/hooks.js index c4719b18..f9b68fe7 100644 --- a/src/static/js/pluginfw/hooks.js +++ b/src/static/js/pluginfw/hooks.js @@ -19,7 +19,7 @@ function checkDeprecation(hook) { const notice = exports.deprecationNotices[hook.hook_name]; if (notice == null) return; if (deprecationWarned[hook.hook_fn_name]) return; - console.warn(`${hook.hook_name} hook used by the ${hook.part.name} plugin ` + + console.warn(`${hook.hook_name} hook used by the ${hook.part.plugin} plugin ` + `(${hook.hook_fn_name}) is deprecated: ${notice}`); deprecationWarned[hook.hook_fn_name] = true; } @@ -121,7 +121,7 @@ function callHookFnSync(hook, context) { if (outcome != null) { // It was already settled, which indicates a bug. const action = err == null ? 'resolve' : 'reject'; - const msg = (`DOUBLE SETTLE BUG IN HOOK FUNCTION (plugin: ${hook.part.name}, ` + + const msg = (`DOUBLE SETTLE BUG IN HOOK FUNCTION (plugin: ${hook.part.plugin}, ` + `function name: ${hook.hook_fn_name}, hook: ${hook.hook_name}): ` + `Attempt to ${action} via ${how} but it already ${outcome.state} ` + `via ${outcome.how}. Ignoring this attempt to ${action}.`); @@ -135,7 +135,7 @@ function callHookFnSync(hook, context) { } outcome = {state, err, val, how}; if (val && typeof val.then === 'function') { - console.error(`PROHIBITED PROMISE BUG IN HOOK FUNCTION (plugin: ${hook.part.name}, ` + + console.error(`PROHIBITED PROMISE BUG IN HOOK FUNCTION (plugin: ${hook.part.plugin}, ` + `function name: ${hook.hook_fn_name}, hook: ${hook.hook_name}): ` + 'The hook function provided a "thenable" (e.g., a Promise) which is ' + 'prohibited because the hook expects to get the value synchronously.'); @@ -170,7 +170,7 @@ function callHookFnSync(hook, context) { if (val === undefined) { if (outcome != null) return outcome.val; // Already settled via callback. if (hook.hook_fn.length >= 3) { - console.error(`UNSETTLED FUNCTION BUG IN HOOK FUNCTION (plugin: ${hook.part.name}, ` + + console.error(`UNSETTLED FUNCTION BUG IN HOOK FUNCTION (plugin: ${hook.part.plugin}, ` + `function name: ${hook.hook_fn_name}, hook: ${hook.hook_name}): ` + 'The hook function neither called the callback nor returned a non-undefined ' + 'value. This is prohibited because it will result in freezes when a future ' + @@ -261,7 +261,7 @@ async function callHookFnAsync(hook, context) { if (outcome != null) { // It was already settled, which indicates a bug. const action = err == null ? 'resolve' : 'reject'; - const msg = (`DOUBLE SETTLE BUG IN HOOK FUNCTION (plugin: ${hook.part.name}, ` + + const msg = (`DOUBLE SETTLE BUG IN HOOK FUNCTION (plugin: ${hook.part.plugin}, ` + `function name: ${hook.hook_fn_name}, hook: ${hook.hook_name}): ` + `Attempt to ${action} via ${how} but it already ${outcome.state} ` + `via ${outcome.how}. Ignoring this attempt to ${action}.`); diff --git a/src/static/js/pluginfw/shared.js b/src/static/js/pluginfw/shared.js index 5994ea6f..48d5b59b 100644 --- a/src/static/js/pluginfw/shared.js +++ b/src/static/js/pluginfw/shared.js @@ -51,9 +51,9 @@ function extractHooks(parts, hook_set_name, normalizer) { const disabledReason = (disabledHookReasons[hook_set_name] || {})[hook_name]; if (disabledReason) { console.error(`Hook ${hook_set_name}/${hook_name} is disabled. Reason: ${disabledReason}`); - console.error(`The hook function ${hook_fn_name} from plugin ${part.name} ` + + console.error(`The hook function ${hook_fn_name} from plugin ${part.plugin} ` + 'will never be called, which may cause the plugin to fail'); - console.error(`Please update the ${part.name} plugin to not use the ${hook_name} hook`); + console.error(`Please update the ${part.plugin} plugin to not use the ${hook_name} hook`); return; } diff --git a/tests/backend/specs/hooks.js b/tests/backend/specs/hooks.js index 3b2c15e7..598115b0 100644 --- a/tests/backend/specs/hooks.js +++ b/tests/backend/specs/hooks.js @@ -45,7 +45,7 @@ describe(__filename, function() { // change behavior depending on the number of parameters. hook_fn: (hn, ctx, cb) => cb(ret), hook_fn_name: hookFnName, - part: {name: 'testPluginName'}, + part: {plugin: 'testPluginName'}, }; };