From bfd13b7689a63e04163b1cef7c18577b1461b3aa Mon Sep 17 00:00:00 2001 From: Gergo Tolnai Date: Sat, 4 Jul 2020 15:04:49 +0200 Subject: [PATCH] fix: exit 1 in case of any errors --- src/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 2c24ba9..5d86c69 100644 --- a/src/index.js +++ b/src/index.js @@ -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); } })();