pluginfw: Improve hook function load error message

pull/4917/head
Richard Hansen 2021-03-03 03:10:49 -05:00 committed by John McLear
parent f95b09e0b6
commit 7e698baa80
1 changed files with 4 additions and 3 deletions

View File

@ -55,9 +55,10 @@ const extractHooks = (parts, hookSetName, normalizer) => {
try {
hookFn = loadFn(hookFnName, hookName);
if (!hookFn) throw new Error('Not a function');
} catch (exc) {
console.error(`Failed to load '${hookFnName}' for ` +
`'${part.full_name}/${hookSetName}/${hookName}': ${exc.toString()}`);
} catch (err) {
console.error(`Failed to load hook function "${hookFnName}" for plugin "${part.plugin}" ` +
`part "${part.name}" hook set "${hookSetName}" hook "${hookName}": ` +
`${err.stack || err}`);
}
if (hookFn) {
if (hooks[hookName] == null) hooks[hookName] = [];