review-comments: remove syntax-error handling for SARIF from upload-lib

This commit is contained in:
Fotis Koutoulakis (@NlightNFotis) 2025-04-01 15:10:16 +01:00
parent 55ee663d5f
commit b53826d56d
12 changed files with 24 additions and 14 deletions

View file

@ -81,8 +81,14 @@ async function run() {
}
catch (unwrappedError) {
const isThirdPartyAnalysis = !(0, status_report_1.isFirstPartyAnalysis)(status_report_1.ActionName.UploadSarif);
const error = isThirdPartyAnalysis &&
unwrappedError instanceof upload_lib.InvalidSarifUploadError
// This is testing the error to check if it belongs to one of two categories we reliably
// know to be configuration errors in certain cases.
const configurationErrorCandidate =
// There was a problem uploading the SARIF file (perhaps rejected by the backend)
unwrappedError instanceof upload_lib.InvalidSarifUploadError ||
// There was a problem validating the JSON (SARIF) file.
unwrappedError instanceof SyntaxError;
const error = isThirdPartyAnalysis && configurationErrorCandidate
? new util_1.ConfigurationError(unwrappedError.message)
: (0, util_1.wrapError)(unwrappedError);
const message = error.message;