diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2017-05-12 12:37:41 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-05-26 04:55:19 +0300 |
commit | 5867a4c592b8a07564e4926657fac754bcc84ab7 (patch) | |
tree | e425815f05dbda4bdfed778b516a3873b6e1b78a /lib | |
parent | d27c18195478462d7e5dcdbdba220e790e07af12 (diff) |
finalize: fix some dropped error issues
Diffstat (limited to 'lib')
-rw-r--r-- | lib/install/action/finalize.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/install/action/finalize.js b/lib/install/action/finalize.js index f8e2c884f..1e8647571 100644 --- a/lib/install/action/finalize.js +++ b/lib/install/action/finalize.js @@ -34,9 +34,11 @@ module.exports = function (staging, pkg, log) { .then(restoreOldNodeModules) .catch((err) => { if (movedDestAway) { - return rimraf(pkg.realpath).then(moveOldDestinationBack).thenReturn(Promise.reject(err)) + return rimraf(pkg.realpath).then(moveOldDestinationBack).then(() => { + throw err + }) } else { - return Promise.reject(err) + throw err } }) .then(() => rimraf(delpath)) @@ -53,7 +55,9 @@ module.exports = function (staging, pkg, log) { } function destinationIsClear () { - return lstat(pkg.realpath).then(() => Bluebird.reject(new Error('destination exists')), () => Bluebird.resolve()) + return lstat(pkg.realpath).then(() => { + throw new Error('destination exists') + }, () => {}) } function actuallyMoveStaging () { @@ -61,7 +65,9 @@ module.exports = function (staging, pkg, log) { } function moveOldDestinationAway () { - return rimraf(delpath).then(() => move(pkg.realpath, delpath, moveOpts)).then(() => { movedDestAway = true }) + return rimraf(delpath).then(() => { + return move(pkg.realpath, delpath, moveOpts) + }).then(() => { movedDestAway = true }) } function moveOldDestinationBack () { |