Include fatal error context on a single line where possible
This commit is contained in:
parent
65a297b952
commit
a3ef0b984b
3 changed files with 17 additions and 11 deletions
12
lib/codeql.js
generated
12
lib/codeql.js
generated
|
|
@ -751,14 +751,18 @@ function extractFatalErrors(error) {
|
||||||
let match;
|
let match;
|
||||||
while ((match = fatalErrorRegex.exec(error)) !== null) {
|
while ((match = fatalErrorRegex.exec(error)) !== null) {
|
||||||
if (lastFatalErrorIndex !== undefined) {
|
if (lastFatalErrorIndex !== undefined) {
|
||||||
fatalErrors.push(error.slice(lastFatalErrorIndex, match.index));
|
fatalErrors.push(error.slice(lastFatalErrorIndex, match.index).trim());
|
||||||
}
|
}
|
||||||
lastFatalErrorIndex = match.index;
|
lastFatalErrorIndex = match.index;
|
||||||
}
|
}
|
||||||
if (lastFatalErrorIndex !== undefined) {
|
if (lastFatalErrorIndex !== undefined) {
|
||||||
const lastError = error.slice(lastFatalErrorIndex);
|
const lastError = error.slice(lastFatalErrorIndex).trim();
|
||||||
return (lastError +
|
if (fatalErrors.length === 0) {
|
||||||
(fatalErrors.length > 0 ? `\nContext:\n${fatalErrors.join("\n")}` : ""));
|
// No other errors
|
||||||
|
return lastError;
|
||||||
|
}
|
||||||
|
const separator = fatalErrors.some((e) => e.includes("\n")) ? "\n" : " ";
|
||||||
|
return [lastError, "Context:", ...fatalErrors.reverse()].join(separator);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1170,16 +1170,18 @@ function extractFatalErrors(error: string): string | undefined {
|
||||||
let match: RegExpMatchArray | null;
|
let match: RegExpMatchArray | null;
|
||||||
while ((match = fatalErrorRegex.exec(error)) !== null) {
|
while ((match = fatalErrorRegex.exec(error)) !== null) {
|
||||||
if (lastFatalErrorIndex !== undefined) {
|
if (lastFatalErrorIndex !== undefined) {
|
||||||
fatalErrors.push(error.slice(lastFatalErrorIndex, match.index));
|
fatalErrors.push(error.slice(lastFatalErrorIndex, match.index).trim());
|
||||||
}
|
}
|
||||||
lastFatalErrorIndex = match.index;
|
lastFatalErrorIndex = match.index;
|
||||||
}
|
}
|
||||||
if (lastFatalErrorIndex !== undefined) {
|
if (lastFatalErrorIndex !== undefined) {
|
||||||
const lastError = error.slice(lastFatalErrorIndex);
|
const lastError = error.slice(lastFatalErrorIndex).trim();
|
||||||
return (
|
if (fatalErrors.length === 0) {
|
||||||
lastError +
|
// No other errors
|
||||||
(fatalErrors.length > 0 ? `\nContext:\n${fatalErrors.join("\n")}` : "")
|
return lastError;
|
||||||
);
|
}
|
||||||
|
const separator = fatalErrors.some((e) => e.includes("\n")) ? "\n" : " ";
|
||||||
|
return [lastError, "Context:", ...fatalErrors.reverse()].join(separator);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue