Skip to content

Commit a06246c

Browse files
committed
Update error messages to better handle long commands
When running this action with large number of environment variables the resulting gcloud command gets very long, and if it fails the error message visible in github actions output is cut off before it gets to the actually useful bit with the error message, making it impossible to tell what went wrong. This adjusts the message the put the command at the end. It's likely less interesting since it's constructed from inputs the user provides anyway.
1 parent 1477328 commit a06246c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ export async function run(): Promise<void> {
317317
const errMsg =
318318
deployCmdExec.stderr ||
319319
`command exited ${deployCmdExec.exitCode}, but stderr had no output`;
320-
throw new Error(`failed to execute gcloud command \`${commandString}\`: ${errMsg}`);
320+
throw new Error(`failed to deploy: ${errMsg}, full command: \`${commandString}\``);
321321
}
322322
setActionOutputs(parseDeployResponse(deployCmdExec.stdout, { tag: tag }));
323323

@@ -328,7 +328,7 @@ export async function run(): Promise<void> {
328328
const errMsg =
329329
updateTrafficExec.stderr ||
330330
`command exited ${updateTrafficExec.exitCode}, but stderr had no output`;
331-
throw new Error(`failed to execute gcloud command \`${commandString}\`: ${errMsg}`);
331+
throw new Error(`failed to update traffic: ${errMsg}, full command: \`${commandString}\``);
332332
}
333333
setActionOutputs(parseUpdateTrafficResponse(updateTrafficExec.stdout));
334334
}

0 commit comments

Comments
 (0)