Improve CommandInvocationError message

This commit is contained in:
Henry Mercer
2023-07-20 18:58:37 +01:00
parent c84418936e
commit 0f871fa80d
6 changed files with 19 additions and 12 deletions

View File

@@ -51,9 +51,12 @@ export class CommandInvocationError extends Error {
public error: string,
public output: string
) {
const prettyCommand = [cmd, ...args]
.map((x) => (x.includes(" ") ? `'${x}'` : x))
.join(" ");
super(
`Failure invoking ${cmd} with arguments ${args}.\n` +
`Exit code ${exitCode} and error was:\n` +
`Encountered a fatal error while running "${prettyCommand}".\n` +
`Exit code was ${exitCode} and error was:\n` +
`${error}`
);
}