From 6939e27b466af33d89a70f8d50f18324a1d77596 Mon Sep 17 00:00:00 2001 From: Anton Golub Date: Sun, 3 Nov 2019 22:41:28 +0300 Subject: [PATCH] style: rollback to ecma 2017 catches --- .travis.yml | 1 + lib/getManifest.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f2f724..a5d3b4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,7 @@ jobs: node_js: - "8" - "10" + - "12" script: - yarn test - stage: release diff --git a/lib/getManifest.js b/lib/getManifest.js index adfbbf7..4d72cfb 100644 --- a/lib/getManifest.js +++ b/lib/getManifest.js @@ -17,7 +17,7 @@ function getManifest(path) { let stat; try { stat = lstatSync(path); - } catch { + } catch (_) { // istanbul ignore next (hard to test — happens if no read acccess etc). throw new ReferenceError(`package.json cannot be read: "${path}"`); } @@ -29,7 +29,7 @@ function getManifest(path) { let contents; try { contents = readFileSync(path, "utf8"); - } catch { + } catch (_) { // istanbul ignore next (hard to test — happens if no read access etc). throw new ReferenceError(`package.json cannot be read: "${path}"`); } @@ -38,7 +38,7 @@ function getManifest(path) { let manifest; try { manifest = JSON.parse(contents); - } catch { + } catch (_) { throw new SyntaxError(`package.json could not be parsed: "${path}"`); }