From 5729222a89467f08e44d6c421997baf529f1b1c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Tue, 4 Apr 2017 23:25:37 -0700 Subject: [PATCH] fix(cache): fix handling of errors in cache reads --- cache.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cache.js b/cache.js index d225e6e..210278f 100644 --- a/cache.js +++ b/cache.js @@ -59,14 +59,13 @@ module.exports = class Cache { } return new this.Promise((resolve, reject) => { fs.stat(info.path, (err, stat) => { - if (err && err !== 'ENOENT') { - return resolve(err) + if (err) { + return reject(err) } else { return resolve(stat) } }) }).then(stat => { - if (!stat) { return } const cachePath = this._path let disturbed = false // avoid opening cache file handles until a user actually tries to