Improve CommandInvocationError message
This commit is contained in:
parent
c84418936e
commit
0f871fa80d
6 changed files with 19 additions and 12 deletions
|
|
@ -1185,11 +1185,12 @@ test("database finalize does not override no code found error on CodeQL 2.12.4",
|
|||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
|
||||
await t.throwsAsync(
|
||||
async () => await codeqlObject.finalizeDatabase("", "", ""),
|
||||
async () =>
|
||||
await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"),
|
||||
{
|
||||
message:
|
||||
"Failure invoking codeql-for-testing with arguments database,finalize,--finalize-dataset,,,.\n" +
|
||||
`Exit code 32 and error was:\n${cliMessage}`,
|
||||
'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db".\n' +
|
||||
`Exit code was 32 and error was:\n${cliMessage}`,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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}`
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue