mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-10 01:23:04 +01:00
fix: don't crash if there are exceptions in action hooks
since some action hooks are called without an await
This commit is contained in:
@@ -275,8 +275,12 @@ async function fireActionHook(hook, hookList, params) {
|
||||
winston.warn(`[plugins] Expected method for hook '${hook}' in plugin '${hookObj.id}' not found, skipping.`);
|
||||
}
|
||||
} else {
|
||||
// eslint-disable-next-line
|
||||
await hookObj.method(params);
|
||||
try {
|
||||
// eslint-disable-next-line
|
||||
await hookObj.method(params);
|
||||
} catch (err) {
|
||||
winston.error(`[plugins] Error in hook ${hookObj.id}@${hookObj.hook} \n${err.stack}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user