Skip to content

Commit 65a297b

Browse files
committed
Display the error message on one line if possible
1 parent 0f871fa commit 65a297b

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

lib/codeql.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.test.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/codeql.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,8 +1189,8 @@ test("database finalize does not override no code found error on CodeQL 2.12.4",
11891189
await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"),
11901190
{
11911191
message:
1192-
'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db".\n' +
1193-
`Exit code was 32 and error was:\n${cliMessage}`,
1192+
'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
1193+
`Exit code was 32 and error was: ${cliMessage}`,
11941194
}
11951195
);
11961196
});

src/codeql.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ export class CommandInvocationError extends Error {
5454
const prettyCommand = [cmd, ...args]
5555
.map((x) => (x.includes(" ") ? `'${x}'` : x))
5656
.join(" ");
57+
error = error.trim();
58+
const separator = error.includes("\n") ? "\n" : " ";
5759
super(
58-
`Encountered a fatal error while running "${prettyCommand}".\n` +
59-
`Exit code was ${exitCode} and error was:\n` +
60+
`Encountered a fatal error while running "${prettyCommand}".${separator}` +
61+
`Exit code was ${exitCode} and error was:${separator}` +
6062
`${error}`
6163
);
6264
}

0 commit comments

Comments
 (0)