X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fplugins%2Fplugin-manager.ts;h=6599bcccaf28f95f70eb936a88a66a7c4e8e2bb4;hb=679c12e69c9f3a2d003ee3abe8b8da49f25b2bd3;hp=6b9a255a4bd2d182fce90031ad3eb06e53439aa0;hpb=428ccb8b7a44ce60cabb7401a5464cf5fcbd4dba;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index 6b9a255a4..6599bccca 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts @@ -304,22 +304,28 @@ export class PluginManager implements ServerHook { uninstalled: false, peertubeEngine: packageJSON.engine.peertube }, { returning: true }) - } catch (err) { - logger.error('Cannot install plugin %s, removing it...', toInstall, { err }) + + logger.info('Successful installation of plugin %s.', toInstall) + + await this.registerPluginOrTheme(plugin) + } catch (rootErr) { + logger.error('Cannot install plugin %s, removing it...', toInstall, { err: rootErr }) try { - await removeNpmPlugin(npmName) + await this.uninstall(npmName) } catch (err) { - logger.error('Cannot remove plugin %s after failed installation.', toInstall, { err }) + logger.error('Cannot uninstall plugin %s after failed installation.', toInstall, { err }) + + try { + await removeNpmPlugin(npmName) + } catch (err) { + logger.error('Cannot remove plugin %s after failed installation.', toInstall, { err }) + } } - throw err + throw rootErr } - logger.info('Successful installation of plugin %s.', toInstall) - - await this.registerPluginOrTheme(plugin) - return plugin } @@ -425,8 +431,7 @@ export class PluginManager implements ServerHook { await ensureDir(registerOptions.peertubeHelpers.plugin.getDataDirectoryPath()) - library.register(registerOptions) - .catch(err => logger.error('Cannot register plugin %s.', npmName, { err })) + await library.register(registerOptions) logger.info('Add plugin %s CSS to global file.', npmName)