diff --git a/lib/core.js b/lib/core.js index 7a7e573..9cece75 100644 --- a/lib/core.js +++ b/lib/core.js @@ -2,6 +2,8 @@ const { getOctokit } = require('./recorder'); +const AggregateError = require('aggregate-error'); + const DEFAULT_MIN_APPROVALS = 1; const CONFIG_FILE = 'merge-me.yml'; @@ -274,7 +276,7 @@ async function getCollaboratorReviews(context, pullRequest) { continue; } - throw error; + throw new AggregateError([ error ]); } } @@ -687,7 +689,7 @@ async function merge(context, pullRequest) { return false; } else { - throw error; + throw new AggregateError([ error ]); } } } @@ -720,7 +722,7 @@ async function checkMerge(context, pullRequest) { } else if (isMergeCheckError(error)) { context.log.debug(ctx, `skipping: ${error.message}`); } else { - throw error; + throw new AggregateError([ error ]); } } @@ -950,7 +952,7 @@ async function getTeamsWithMembers(context, pullRequest, reviewTeams) { throw MergeCheckError(`failed to fetch team ${teamSlug}`); } - throw error; + throw new AggregateError([ error ]); }); return members; diff --git a/package-lock.json b/package-lock.json index c223290..df6b22d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1412,10 +1412,9 @@ } }, "aggregate-error": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", - "integrity": "sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA==", - "dev": true, + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", "requires": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" diff --git a/package.json b/package.json index 5934084..fafdeb7 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "auto-test": "nodemon --exec npm test" }, "dependencies": { + "aggregate-error": "^3.1.0", "probot": "^10.19.0" }, "devDependencies": {