diff --git a/plugins.js b/plugins.js index d0ee1ba9..d5275af4 100644 --- a/plugins.js +++ b/plugins.js @@ -233,7 +233,7 @@ function requirePlugins () { mod = require(path); if (!mod || (!mod.onApp && !mod.onWindow && !mod.onUnload && - !mod.middleware && + !mod.middleware && !mod.reduceUI && !mod.reduceSessions && !mod.decorateConfig && !mod.decorateMenu && !mod.decorateTerm && !mod.decorateHyperTerm && !mod.decorateTab && !mod.decorateNotification && @@ -243,6 +243,10 @@ function requirePlugins () { 'HyperTerm extension API methods'); return; } + + // populate the name for internal errors here + mod._name = basename(path); + return mod; } catch (err) { notify('Plugin error!', `Plugin "${basename(path)}" failed to load (${err.message})`); @@ -285,15 +289,15 @@ exports.decorateMenu = function (tpl) { return decorated; }; -exports.decorateConfig = function (config) { - let decorated = config; +exports.getDecoratedConfig = function () { + let decorated = config.getConfig(); modules.forEach((plugin) => { if (plugin.decorateConfig) { const res = plugin.decorateConfig(decorated); - if (res) { + if (res && 'object' === typeof res) { decorated = res; } else { - console.error('incompatible response type for `decorateConfig`'); + notify('Plugin error!', `"${plugin._name}": invalid return type for \`decorateConfig\``); } } });