aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-17 16:19:30 +0200
committerChocobozzz <me@florianbigard.com>2023-05-17 16:19:30 +0200
commitf86ff3a02642263ac64db5d5fba4059db0092561 (patch)
tree278ac671e976e92107ff4e62732a4ff9bc5fae5a
parent1281e6a5f7f783cdfe1786bb5d3c27ade3c3ea19 (diff)
downloadPeerTube-f86ff3a02642263ac64db5d5fba4059db0092561.tar.gz
PeerTube-f86ff3a02642263ac64db5d5fba4059db0092561.tar.zst
PeerTube-f86ff3a02642263ac64db5d5fba4059db0092561.zip
Prevent uninstall error on install error
-rw-r--r--server/lib/plugins/plugin-manager.ts16
1 files changed, 9 insertions, 7 deletions
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts
index eab0b3978..9086a4c8e 100644
--- a/server/lib/plugins/plugin-manager.ts
+++ b/server/lib/plugins/plugin-manager.ts
@@ -370,15 +370,17 @@ export class PluginManager implements ServerHook {
370 } catch (rootErr) { 370 } catch (rootErr) {
371 logger.error('Cannot install plugin %s, removing it...', toInstall, { err: rootErr }) 371 logger.error('Cannot install plugin %s, removing it...', toInstall, { err: rootErr })
372 372
373 try { 373 if (npmName) {
374 await this.uninstall({ npmName })
375 } catch (err) {
376 logger.error('Cannot uninstall plugin %s after failed installation.', toInstall, { err })
377
378 try { 374 try {
379 await removeNpmPlugin(npmName) 375 await this.uninstall({ npmName })
380 } catch (err) { 376 } catch (err) {
381 logger.error('Cannot remove plugin %s after failed installation.', toInstall, { err }) 377 logger.error('Cannot uninstall plugin %s after failed installation.', toInstall, { err })
378
379 try {
380 await removeNpmPlugin(npmName)
381 } catch (err) {
382 logger.error('Cannot remove plugin %s after failed installation.', toInstall, { err })
383 }
382 } 384 }
383 } 385 }
384 386