diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/plugins/plugin-manager.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index 9e4ec5adf..570b56193 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts | |||
@@ -104,10 +104,12 @@ export class PluginManager { | |||
104 | 104 | ||
105 | for (const hook of this.hooks[hookName]) { | 105 | for (const hook of this.hooks[hookName]) { |
106 | try { | 106 | try { |
107 | const p = hook.handler(param) | ||
108 | |||
107 | if (wait) { | 109 | if (wait) { |
108 | result = await hook.handler(param) | 110 | result = await p |
109 | } else { | 111 | } else if (p.catch) { |
110 | result = hook.handler() | 112 | p.catch(err => logger.warn('Hook %s of plugin %s thrown an error.', hookName, hook.pluginName, { err })) |
111 | } | 113 | } |
112 | } catch (err) { | 114 | } catch (err) { |
113 | logger.error('Cannot run hook %s of plugin %s.', hookName, hook.pluginName, { err }) | 115 | logger.error('Cannot run hook %s of plugin %s.', hookName, hook.pluginName, { err }) |
@@ -329,7 +331,7 @@ export class PluginManager { | |||
329 | registerSetting, | 331 | registerSetting, |
330 | settingsManager, | 332 | settingsManager, |
331 | storageManager | 333 | storageManager |
332 | }) | 334 | }).catch(err => logger.error('Cannot register plugin %s.', npmName, { err })) |
333 | 335 | ||
334 | logger.info('Add plugin %s CSS to global file.', npmName) | 336 | logger.info('Add plugin %s CSS to global file.', npmName) |
335 | 337 | ||
@@ -365,7 +367,7 @@ export class PluginManager { | |||
365 | private async regeneratePluginGlobalCSS () { | 367 | private async regeneratePluginGlobalCSS () { |
366 | await this.resetCSSGlobalFile() | 368 | await this.resetCSSGlobalFile() |
367 | 369 | ||
368 | for (const key of Object.keys(this.registeredPlugins)) { | 370 | for (const key of Object.keys(this.getRegisteredPlugins())) { |
369 | const plugin = this.registeredPlugins[key] | 371 | const plugin = this.registeredPlugins[key] |
370 | 372 | ||
371 | await this.addCSSToGlobalFile(plugin.path, plugin.css) | 373 | await this.addCSSToGlobalFile(plugin.path, plugin.css) |