diff options
Diffstat (limited to 'server/lib/plugins')
-rw-r--r-- | server/lib/plugins/hooks.ts | 2 | ||||
-rw-r--r-- | server/lib/plugins/plugin-manager.ts | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/server/lib/plugins/hooks.ts b/server/lib/plugins/hooks.ts index b694d4118..bcc8c674e 100644 --- a/server/lib/plugins/hooks.ts +++ b/server/lib/plugins/hooks.ts | |||
@@ -9,7 +9,7 @@ type RawFunction <U, T> = (params: U) => T | |||
9 | // Helpers to run hooks | 9 | // Helpers to run hooks |
10 | const Hooks = { | 10 | const Hooks = { |
11 | wrapObject: <T, U extends ServerFilterHookName>(result: T, hookName: U) => { | 11 | wrapObject: <T, U extends ServerFilterHookName>(result: T, hookName: U) => { |
12 | return PluginManager.Instance.runHook(hookName, result) as Promise<T> | 12 | return PluginManager.Instance.runHook(hookName, result) |
13 | }, | 13 | }, |
14 | 14 | ||
15 | wrapPromiseFun: async <U, T, V extends ServerFilterHookName>(fun: PromiseFunction<U, T>, params: U, hookName: V) => { | 15 | wrapPromiseFun: async <U, T, V extends ServerFilterHookName>(fun: PromiseFunction<U, T>, params: U, hookName: V) => { |
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index 6485a47c5..afc07a151 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts | |||
@@ -125,6 +125,13 @@ export class PluginManager implements ServerHook { | |||
125 | try { | 125 | try { |
126 | await this.registerPluginOrTheme(plugin) | 126 | await this.registerPluginOrTheme(plugin) |
127 | } catch (err) { | 127 | } catch (err) { |
128 | // Try to unregister the plugin | ||
129 | try { | ||
130 | await this.unregister(PluginModel.buildNpmName(plugin.name, plugin.type)) | ||
131 | } catch { | ||
132 | // we don't care if we cannot unregister it | ||
133 | } | ||
134 | |||
128 | logger.error('Cannot register plugin %s, skipping.', plugin.name, { err }) | 135 | logger.error('Cannot register plugin %s, skipping.', plugin.name, { err }) |
129 | } | 136 | } |
130 | } | 137 | } |