Display the error message on one line if possible

This commit is contained in:
Henry Mercer 2023-07-21 11:40:07 +01:00
parent 0f871fa80d
commit 65a297b952
6 changed files with 14 additions and 10 deletions

6
lib/codeql.js generated
View file

@ -41,8 +41,10 @@ class CommandInvocationError extends Error {
const prettyCommand = [cmd, ...args]
.map((x) => (x.includes(" ") ? `'${x}'` : x))
.join(" ");
super(`Encountered a fatal error while running "${prettyCommand}".\n` +
`Exit code was ${exitCode} and error was:\n` +
error = error.trim();
const separator = error.includes("\n") ? "\n" : " ";
super(`Encountered a fatal error while running "${prettyCommand}".${separator}` +
`Exit code was ${exitCode} and error was:${separator}` +
`${error}`);
this.exitCode = exitCode;
this.error = error;