mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 11:06:40 +02: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.`);
|
winston.warn(`[plugins] Expected method for hook '${hook}' in plugin '${hookObj.id}' not found, skipping.`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// eslint-disable-next-line
|
try {
|
||||||
await hookObj.method(params);
|
// 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