review-comments: nest validateSariFileSchema into try-catch block to better discriminate error thrown
This commit is contained in:
parent
498c7f37e8
commit
676a422916
6 changed files with 25 additions and 24 deletions
9
lib/upload-sarif-action.js
generated
9
lib/upload-sarif-action.js
generated
|
|
@ -80,15 +80,8 @@ async function run() {
|
|||
await sendSuccessStatusReport(startedAt, uploadResult.statusReport, logger);
|
||||
}
|
||||
catch (unwrappedError) {
|
||||
// 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 = (0, status_report_1.isThirdPartyAnalysis)(status_report_1.ActionName.UploadSarif) &&
|
||||
configurationErrorCandidate
|
||||
unwrappedError instanceof upload_lib.InvalidSarifUploadError
|
||||
? new util_1.ConfigurationError(unwrappedError.message)
|
||||
: (0, util_1.wrapError)(unwrappedError);
|
||||
const message = error.message;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue