From 6b4ec893d801876f6886bdfdcc1813ec355b22d7 Mon Sep 17 00:00:00 2001 From: alexandercerutti Date: Sun, 26 Aug 2018 12:02:13 +0200 Subject: [PATCH] Changed implementation inside __parseSettings for the certificates to throw in case of necessity --- index.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index a2ae564..b467644 100644 --- a/index.js +++ b/index.js @@ -583,18 +583,21 @@ class Pass { return readFile(resolvedPath); }); - return Promise.all(certPaths).then(contents => { - contents.forEach((file, index) => { - let certName = optCertsNames[index]; - let pem = parsePEM(file, options.certificates[certName].passphrase); + return Promise.all(certPaths) + .then(contents => { + contents.forEach((file, index) => { + let certName = optCertsNames[index]; + let pem = parsePEM(file, options.certificates[certName].passphrase); - if (!pem) { - return reject(errors.INVALID_CERTS) - } + if (!pem) { + return reject(errors.INVALID_CERTS) + } - this.Certificates[certName] = pem; + this.Certificates[certName] = pem; + }); + }).catch(err => { + throw new Error(errors.INVALID_CERTS); }); - }); } }