-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Rethrown error when streaming #397
Comments
It looks like this only happens with |
So the rethrown error is not actually coming from the SDK, but rather, the stream object. Handling the 'error' event on the stream fixes it for me: getStream('non-existing').
on('error', function() { console.log('ERR!'); }).
pipe(devNull); Output:
That is ideally where you want to do error handling on streams, as there could be other errors coming from the stream itself. The SDK has always piped all errors from the error event to the stream's error event so there would be a single unified event for all errors-- I'm not entirely sure why that didn't cause it to be thrown before. Perhaps the SDK wasn't correctly piping these specific errors before? |
Thanks @lsegal, that works for me. Is there some documentation mentioning this that I have missed? |
@BorePlusPlus because the SDK simply returns a regular stream object, the behavior for fs.createReadStream('invalid-file'); // throws Error: ENOENT, open 'invalid-file'
fs.createReadStream('invalid-file').
on('error', function() { console.log(':(') }); // prints ":(" Marking this as closed since it seems like the SDK is (now) behaving as expected. Feel free to open another issue if you have any more questions or problems! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Hello,
Recently I noticed that my streaming download code is "blowing up" the process when trying to download non-existing object (my guess is it's probably same for all error conditions). The stripped down use case looks like this.
Pre 1e277ec this just printed the sad face
:(
, but after that commit the process is killed by an unhandled error, a bit like so:Could you please spare some time to look into this (or suggest alternative implementation)?
Cheers,
Dali
The text was updated successfully, but these errors were encountered: