Skip to content

Commit 0286ba5

Browse files
committedFeb 23, 2018
fix(tarball): fix spurious errors from tarball.stream()
1 parent 838e622 commit 0286ba5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎lib/with-tarball-stream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function withTarballStream (spec, opts, streamHandler) {
103103
// Retry once if we have a cache, to clear up any weird conditions.
104104
// Don't retry network errors, though -- make-fetch-happen has already
105105
// taken care of making sure we're all set on that front.
106-
if (opts.cache && !err.code.match(/^E\d{3}$/)) {
106+
if (opts.cache && err.code && !err.code.match(/^E\d{3}$/)) {
107107
if (err.code === 'EINTEGRITY' || err.code === 'Z_DATA_ERROR') {
108108
opts.log.warn('tarball', `tarball data for ${spec} (${opts.integrity}) seems to be corrupted. Trying one more time.`)
109109
}

‎tarball.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ function tarballStream (spec, opts) {
3333
throw new Error('abort, abort!')
3434
} else {
3535
return new BB((resolve, reject) => {
36+
stream.on('error', reject)
3637
output.on('error', reject)
3738
output.on('error', () => { hasTouchedOutput = true })
38-
stream.on('error', err => output.emit('error', err))
3939
output.on('finish', resolve)
4040
stream.pipe(output)
4141
stream.once('data', () => { hasTouchedOutput = true })

0 commit comments

Comments
 (0)
Please sign in to comment.