Improve function name
This commit is contained in:
parent
79690d4663
commit
bcfe48982e
3 changed files with 11 additions and 5 deletions
7
lib/upload-lib.js
generated
7
lib/upload-lib.js
generated
|
|
@ -332,7 +332,7 @@ async function waitForProcessing(repositoryNwo, sarifID, logger, options = {
|
||||||
}
|
}
|
||||||
else if (status === "failed") {
|
else if (status === "failed") {
|
||||||
const message = `Code Scanning could not process the submitted SARIF file:\n${response.data.errors}`;
|
const message = `Code Scanning could not process the submitted SARIF file:\n${response.data.errors}`;
|
||||||
throw areProcessingErrorsUserError(response.data.errors)
|
throw shouldConsiderAsUserError(response.data.errors)
|
||||||
? new util_1.UserError(message)
|
? new util_1.UserError(message)
|
||||||
: new Error(message);
|
: new Error(message);
|
||||||
}
|
}
|
||||||
|
|
@ -349,7 +349,10 @@ async function waitForProcessing(repositoryNwo, sarifID, logger, options = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.waitForProcessing = waitForProcessing;
|
exports.waitForProcessing = waitForProcessing;
|
||||||
function areProcessingErrorsUserError(processingErrors) {
|
/**
|
||||||
|
* Returns whether the provided processing errors should be considered a user error.
|
||||||
|
*/
|
||||||
|
function shouldConsiderAsUserError(processingErrors) {
|
||||||
return (processingErrors.length === 1 &&
|
return (processingErrors.length === 1 &&
|
||||||
processingErrors[0] ===
|
processingErrors[0] ===
|
||||||
"CodeQL analyses from advanced configurations cannot be processed when the default setup is enabled");
|
"CodeQL analyses from advanced configurations cannot be processed when the default setup is enabled");
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -473,7 +473,7 @@ export async function waitForProcessing(
|
||||||
break;
|
break;
|
||||||
} else if (status === "failed") {
|
} else if (status === "failed") {
|
||||||
const message = `Code Scanning could not process the submitted SARIF file:\n${response.data.errors}`;
|
const message = `Code Scanning could not process the submitted SARIF file:\n${response.data.errors}`;
|
||||||
throw areProcessingErrorsUserError(response.data.errors as string[])
|
throw shouldConsiderAsUserError(response.data.errors as string[])
|
||||||
? new UserError(message)
|
? new UserError(message)
|
||||||
: new Error(message);
|
: new Error(message);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -489,7 +489,10 @@ export async function waitForProcessing(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function areProcessingErrorsUserError(processingErrors: string[]): boolean {
|
/**
|
||||||
|
* Returns whether the provided processing errors should be considered a user error.
|
||||||
|
*/
|
||||||
|
function shouldConsiderAsUserError(processingErrors: string[]): boolean {
|
||||||
return (
|
return (
|
||||||
processingErrors.length === 1 &&
|
processingErrors.length === 1 &&
|
||||||
processingErrors[0] ===
|
processingErrors[0] ===
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue