Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Display the error message on one line if possible
  • Loading branch information
henrymercer committed Jul 21, 2023
commit 65a297b95228cbf2c39e6dc4e2af494f869852c5
6 changes: 4 additions & 2 deletions lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/codeql.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.test.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/codeql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
}
);
});
Expand Down
6 changes: 4 additions & 2 deletions src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
);
}
Expand Down