From 3c9f965a4a6849799b005542a94911be7fa61e15 Mon Sep 17 00:00:00 2001 From: "Kai J." Date: Wed, 12 Jun 2024 14:36:20 +0200 Subject: [PATCH] more explicit log --- packages/@ionic/cli/src/lib/integrations/capacitor/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/@ionic/cli/src/lib/integrations/capacitor/index.ts b/packages/@ionic/cli/src/lib/integrations/capacitor/index.ts index 1fbc6ed3c..c3a9740f6 100644 --- a/packages/@ionic/cli/src/lib/integrations/capacitor/index.ts +++ b/packages/@ionic/cli/src/lib/integrations/capacitor/index.ts @@ -187,6 +187,7 @@ export class Integration extends BaseIntegration { }); getCapacitorCLIConfig = lodash.memoize(async (): Promise => { + const command = 'capacitor' const args = ['config', '--json']; debug('Getting config with Capacitor CLI: %O', args); @@ -201,10 +202,13 @@ export class Integration extends BaseIntegration { } catch (err) { throw err; } - })('capacitor', args, { cwd: this.root }) + })(command, args, { cwd: this.root }) } catch (error) { if ((error as any).code === 'ERR_SUBPROCESS_COMMAND_NOT_FOUND') { throw new Error(`Capacitor command not found. Is the Capacitor CLI installed? (npm i -D @capacitor/cli)`); + } else if ((error as any).output) { + const errorLog = "\n> " + ((error as any).output as string).replaceAll("\n", "\n> "); + throw new Error(`'${command} ${args.join(" ")}' failed with: ${errorLog}`); } else { throw new Error((error as any).message); }