Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Reset stream.root after emitting it #20

Merged
merged 1 commit into from Sep 9, 2012

Conversation

santigimeno
Copy link
Contributor

  • This was causing the emission of incorrect objects after an error (see test case).

- This was causing the emission of incorrect objects after an error.
@santigimeno
Copy link
Contributor Author

Related to this change: in the case of a stream with garbage between 2 correct JSON objects, should we try to recover from the error and try to emit the 2 objects of just emit the error and close the stream?

@dominictarr
Copy link
Owner

I will merge this.

Hmm, I'm strongly inclined to just error cleanly.
whitespace between the objects is one thing,
but garbage is another thing.

I'd imagine that in most cases that garbage would be malformed JSON,
and it would be easier to fix if you got an error quickly. something like a '{'
in the garbage could change the meaning of the JSON.

However, if you did want to send JSON through a noisy channel,
@substack has this module: https://github.com/substack/json-scrape
which is targeted at that use-case.

@dominictarr dominictarr merged commit a844b89 into dominictarr:master Sep 9, 2012
@dominictarr
Copy link
Owner

merged into JSONStream@0.4.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants