Browse Source

Prevent uninstall error on install error

pull/5340/merge
Chocobozzz 1 week ago
parent
commit
f86ff3a026
No known key found for this signature in database GPG Key ID: 583A612D890159BE
1 changed files with 9 additions and 7 deletions
  1. +9
    -7
      server/lib/plugins/plugin-manager.ts

+ 9
- 7
server/lib/plugins/plugin-manager.ts View File

@@ -370,15 +370,17 @@ export class PluginManager implements ServerHook {
} catch (rootErr) {
logger.error('Cannot install plugin %s, removing it...', toInstall, { err: rootErr })

try {
await this.uninstall({ npmName })
} catch (err) {
logger.error('Cannot uninstall plugin %s after failed installation.', toInstall, { err })

if (npmName) {
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 })
}
}
}



Loading…
Cancel
Save