Display the error message on one line if possible
This commit is contained in:
parent
0f871fa80d
commit
65a297b952
6 changed files with 14 additions and 10 deletions
|
|
@ -1189,8 +1189,8 @@ test("database finalize does not override no code found error on CodeQL 2.12.4",
|
|||
await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"),
|
||||
{
|
||||
message:
|
||||
'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}`,
|
||||
'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
||||
`Exit code was 32 and error was: ${cliMessage}`,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -54,9 +54,11 @@ export class CommandInvocationError extends Error {
|
|||
const prettyCommand = [cmd, ...args]
|
||||
.map((x) => (x.includes(" ") ? `'${x}'` : x))
|
||||
.join(" ");
|
||||
error = error.trim();
|
||||
const separator = error.includes("\n") ? "\n" : " ";
|
||||
super(
|
||||
`Encountered a fatal error while running "${prettyCommand}".\n` +
|
||||
`Exit code was ${exitCode} and error was:\n` +
|
||||
`Encountered a fatal error while running "${prettyCommand}".${separator}` +
|
||||
`Exit code was ${exitCode} and error was:${separator}` +
|
||||
`${error}`
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue