Rename considerInvalidRequestConfigError to isThirdPartyUpload

This describes what we are trying to do more accurately.
This commit is contained in:
Angela P Wen 2024-02-28 15:22:39 +00:00
parent cc3808ec2a
commit 1a6bac42d0
12 changed files with 22 additions and 22 deletions

11
lib/upload-lib.js generated
View file

@ -152,16 +152,17 @@ exports.findSarifFilesInDir = findSarifFilesInDir;
* Uploads a single SARIF file or a directory of SARIF files depending on what `sarifPath` refers
* to.
*
* @param considerInvalidRequestConfigError Whether an invalid request, for example one with a
* `sarifPath` that does not exist, should be considered a
* user error.
* @param isThirdPartyUpload Whether the SARIF to upload comes from a third party, or from
* first-party CodeQL analysis. If it comes from a third party,
* we classify certain errors as configuration errors for
* telemetry purposes.
*/
async function uploadFromActions(sarifPath, checkoutPath, category, logger, { considerInvalidRequestConfigError: considerInvalidRequestConfigError, }) {
async function uploadFromActions(sarifPath, checkoutPath, category, logger, { isThirdPartyUpload: isThirdPartyUpload }) {
try {
return await uploadFiles(getSarifFilePaths(sarifPath), (0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY")), await actionsUtil.getCommitOid(checkoutPath), await actionsUtil.getRef(), await api.getAnalysisKey(), category, util.getRequiredEnvParam("GITHUB_WORKFLOW"), actionsUtil.getWorkflowRunID(), actionsUtil.getWorkflowRunAttempt(), checkoutPath, actionsUtil.getRequiredInput("matrix"), logger);
}
catch (e) {
if (e instanceof InvalidRequestError && considerInvalidRequestConfigError) {
if (e instanceof InvalidRequestError && isThirdPartyUpload) {
throw new util_1.ConfigurationError(e.message);
}
throw e;