mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
fix: closes #13051, catch errors from widget render
This commit is contained in:
@@ -64,6 +64,7 @@ async function renderWidget(widget, uid, options, location) {
|
|||||||
|
|
||||||
const userLang = config.userLang || meta.config.defaultLang || 'en-GB';
|
const userLang = config.userLang || meta.config.defaultLang || 'en-GB';
|
||||||
const templateData = _.assign({ }, options.templateData, { config: config });
|
const templateData = _.assign({ }, options.templateData, { config: config });
|
||||||
|
try {
|
||||||
const data = await plugins.hooks.fire(`filter:widget.render:${widget.widget}`, {
|
const data = await plugins.hooks.fire(`filter:widget.render:${widget.widget}`, {
|
||||||
uid: uid,
|
uid: uid,
|
||||||
area: options,
|
area: options,
|
||||||
@@ -93,6 +94,10 @@ async function renderWidget(widget, uid, options, location) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return { html };
|
return { html };
|
||||||
|
} catch (err) {
|
||||||
|
winston.error(err.stack);
|
||||||
|
return { html: '' }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
widgets.checkVisibility = async function (data, uid) {
|
widgets.checkVisibility = async function (data, uid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user