From 02742c3c767c3b11263576f13ff07c37f222cebf Mon Sep 17 00:00:00 2001 From: Chareice Date: Tue, 19 Mar 2024 11:01:41 +0800 Subject: [PATCH] chore: plugin command error wrap raw error object --- packages/core/server/src/commands/pm.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/server/src/commands/pm.ts b/packages/core/server/src/commands/pm.ts index 740c4ad4b1..394d09fab7 100644 --- a/packages/core/server/src/commands/pm.ts +++ b/packages/core/server/src/commands/pm.ts @@ -23,7 +23,7 @@ export default (app: Application) => { try { await app.pm.addViaCLI(name, _.cloneDeep(options)); } catch (error) { - throw new PluginCommandError(`Failed to add plugin: ${error.message}`); + throw new PluginCommandError(`Failed to add plugin`, { cause: error }); } }); @@ -42,7 +42,7 @@ export default (app: Application) => { packageName, }); } catch (error) { - throw new PluginCommandError(`Failed to update plugin: ${error.message}`); + throw new PluginCommandError(`Failed to update plugin`, { cause: error }); } }); @@ -54,7 +54,7 @@ export default (app: Application) => { try { await app.pm.enable(plugins); } catch (error) { - throw new PluginCommandError(`Failed to enable plugin: ${error.message}`); + throw new PluginCommandError(`Failed to enable plugin`, { cause: error }); } }); @@ -66,7 +66,7 @@ export default (app: Application) => { try { await app.pm.disable(plugins); } catch (error) { - throw new PluginCommandError(`Failed to disable plugin: ${error.message}`); + throw new PluginCommandError(`Failed to disable plugin`, { cause: error }); } });