mirror of
https://github.com/github/codeql-action
synced 2026-05-31 00:00:46 +03:00
Include fatal error context on a single line where possible
This commit is contained in:
Generated
+8
-4
@@ -751,14 +751,18 @@ function extractFatalErrors(error) {
|
||||
let match;
|
||||
while ((match = fatalErrorRegex.exec(error)) !== null) {
|
||||
if (lastFatalErrorIndex !== undefined) {
|
||||
fatalErrors.push(error.slice(lastFatalErrorIndex, match.index));
|
||||
fatalErrors.push(error.slice(lastFatalErrorIndex, match.index).trim());
|
||||
}
|
||||
lastFatalErrorIndex = match.index;
|
||||
}
|
||||
if (lastFatalErrorIndex !== undefined) {
|
||||
const lastError = error.slice(lastFatalErrorIndex);
|
||||
return (lastError +
|
||||
(fatalErrors.length > 0 ? `\nContext:\n${fatalErrors.join("\n")}` : ""));
|
||||
const lastError = error.slice(lastFatalErrorIndex).trim();
|
||||
if (fatalErrors.length === 0) {
|
||||
// No other errors
|
||||
return lastError;
|
||||
}
|
||||
const separator = fatalErrors.some((e) => e.includes("\n")) ? "\n" : " ";
|
||||
return [lastError, "Context:", ...fatalErrors.reverse()].join(separator);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+8
-6
@@ -1170,16 +1170,18 @@ function extractFatalErrors(error: string): string | undefined {
|
||||
let match: RegExpMatchArray | null;
|
||||
while ((match = fatalErrorRegex.exec(error)) !== null) {
|
||||
if (lastFatalErrorIndex !== undefined) {
|
||||
fatalErrors.push(error.slice(lastFatalErrorIndex, match.index));
|
||||
fatalErrors.push(error.slice(lastFatalErrorIndex, match.index).trim());
|
||||
}
|
||||
lastFatalErrorIndex = match.index;
|
||||
}
|
||||
if (lastFatalErrorIndex !== undefined) {
|
||||
const lastError = error.slice(lastFatalErrorIndex);
|
||||
return (
|
||||
lastError +
|
||||
(fatalErrors.length > 0 ? `\nContext:\n${fatalErrors.join("\n")}` : "")
|
||||
);
|
||||
const lastError = error.slice(lastFatalErrorIndex).trim();
|
||||
if (fatalErrors.length === 0) {
|
||||
// No other errors
|
||||
return lastError;
|
||||
}
|
||||
const separator = fatalErrors.some((e) => e.includes("\n")) ? "\n" : " ";
|
||||
return [lastError, "Context:", ...fatalErrors.reverse()].join(separator);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user