-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle errors from file#createReadStream #615
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1212,6 +1212,8 @@ class File extends ServiceObject<File> { | |
return; | ||
} | ||
|
||
rawResponseStream.on('error', onComplete); | ||
|
||
const headers = rawResponseStream.toJSON().headers; | ||
const isCompressed = headers['content-encoding'] === 'gzip'; | ||
const shouldRunValidation = !rangeRequest && (crc32c || md5); | ||
|
@@ -1235,9 +1237,9 @@ class File extends ServiceObject<File> { | |
rawResponseStream.pipe(pumpify.obj(throughStreams)); | ||
} | ||
|
||
rawResponseStream.on('end', onComplete).pipe(throughStream, { | ||
end: false | ||
}); | ||
rawResponseStream.on('error', onComplete) | ||
.on('end', onComplete) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there any scenarios where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I 'spose anything is possible! I added new code for that, please take a look! |
||
.pipe(throughStream, {end: false}); | ||
}; | ||
|
||
// This is hooked to the `complete` event from the request stream. This is | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is having 2 error listeners with the same callback intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code above this actually re-assigns what
rawResponseStream
is. When we did that, it was to avoid duplicating the event handler assignments.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok, sorry missed that part.