Improve function name

This commit is contained in:
Henry Mercer 2023-07-28 18:51:43 +01:00
parent 79690d4663
commit bcfe48982e
3 changed files with 11 additions and 5 deletions

7
lib/upload-lib.js generated
View file

@ -332,7 +332,7 @@ async function waitForProcessing(repositoryNwo, sarifID, logger, options = {
}
else if (status === "failed") {
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 Error(message);
}
@ -349,7 +349,10 @@ async function waitForProcessing(repositoryNwo, sarifID, logger, options = {
}
}
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 &&
processingErrors[0] ===
"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

View file

@ -473,7 +473,7 @@ export async function waitForProcessing(
break;
} else if (status === "failed") {
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 Error(message);
} 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 (
processingErrors.length === 1 &&
processingErrors[0] ===