Throw the first seen stream error in writeToStream#33
Merged
reconbot merged 8 commits intobustle:masterfrom Mar 31, 2019
dotboris:write-to-stream-errors
Merged
Throw the first seen stream error in writeToStream#33reconbot merged 8 commits intobustle:masterfrom dotboris:write-to-stream-errors
reconbot merged 8 commits intobustle:masterfrom
dotboris:write-to-stream-errors
Conversation
Contributor
Author
|
I'm currently testing this with the example I posted in #30 and it doesn't really work as it should. |
Contributor
|
ha! beat me to it! What do you think of our two approaches? #34 |
Contributor
Author
|
@reconbot I like your approach better. I solves some of the problems that I've been hitting when testing with the example script. |
Contributor
|
I like your tests better than mine, but I like my approach better because we'll never wait for a |
Contributor
Author
|
@reconbot I'll do exactly that |
Contributor
Author
|
@reconbot here you go
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #30
This makes it so that if the stream we're writing to emit's an error, we interrupt reading the iterator and throw an error.
This makes a somewhat reasonable assumption about stream. It assumes that we're pretty much done with the stream once it emits it's first error.
Technically speaking this is not 100% true when it comes to node since a writable stream can still work and process data even if it has already emitted an error. Also, node streams can emit as many errors as they want.
I think that this is still a reasonable approach. Fail-fast is generally speaking a good idea. On top of what node streams will crash the process on their first unhandled error which is similar behaviour.