Skip to content

Commit

Permalink
fix: exit 1 in case of any errors
Browse files Browse the repository at this point in the history
  • Loading branch information
geritol committed Jul 4, 2020
1 parent b7e85a5 commit bfd13b7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
const writeGuard = require("./write-guard");
const loadSettings = require("./load-settings");

const error = (message) => {};

(async () => {
const settings = loadSettings(".");
const accessInfo = await writeGuard(settings);
try {
var accessInfo = await writeGuard(settings);
} catch (error) {
error(error.message);
}
if (accessInfo.some((info) => !info.canWrite)) {
console.error(
error(
`User '${settings.github.user}' has no write access to all files in pull request #${settings.github.prNumber}`
);
process.exit(1);
}
})();

0 comments on commit bfd13b7

Please sign in to comment.