Consistently wrap errors

This commit is contained in:
Henry Mercer 2023-04-06 17:04:21 +01:00
parent 555b602b2f
commit e5c2f32a9f
39 changed files with 145 additions and 122 deletions

3
lib/upload-lib.js generated
View file

@ -40,6 +40,7 @@ const fingerprints = __importStar(require("./fingerprints"));
const repository_1 = require("./repository");
const shared_environment_1 = require("./shared-environment");
const util = __importStar(require("./util"));
const util_1 = require("./util");
const workflow = __importStar(require("./workflow"));
// Takes a list of paths to sarif files and combines them together,
// returning the contents of the combined sarif file.
@ -160,7 +161,7 @@ function countResultsInSarif(sarif) {
parsedSarif = JSON.parse(sarif);
}
catch (e) {
throw new Error(`Invalid SARIF. JSON syntax error: ${e instanceof Error ? e.message : String(e)}`);
throw new Error(`Invalid SARIF. JSON syntax error: ${(0, util_1.wrapError)(e).message}`);
}
if (!Array.isArray(parsedSarif.runs)) {
throw new Error("Invalid SARIF. Missing 'runs' array.");