-
Notifications
You must be signed in to change notification settings - Fork 13
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
add option to throw errors #5
Comments
In fact, I think throw by default is a better choice and the option can be to turn it off. |
I agree (as long as by 'throw' you mean |
One thought I had was that this module could just use the |
I think char-split should be updated to use through2 or we could just re-use existing code in this module and handle the emit error case. Either one works for me and I can make a PR with either method. |
👍 for this feature! |
I had a go at implementing this myself. I found out what your motivation was, and I found it out the hard way. How? First came a puzzling fact: many existing tests failed after this simple commit tomek-he-him@a80ad0f. Only after I’ve noticed that tomek-he-him@3242683 fails while tomek-he-him@5d68241 is OK came enlightenment: The answer: you ignore errors so that this is possible: parser.write('["first part');
// Error while parsing – gets ignored
parser.write('", "second part"]');
// Now it’s valid – JSON data is emitted As I see it, the whole thing would need to be thought over from the ground up to have this feature. I hope I’m wrong though. |
Hi all, #9 fixes this by waiting for a |
👍 Good idea, as far as I can say! |
The code used to be written in a similar way where it was handled via strings. It was changed to use buffers for much more efficient memory usage. I do not think we want to go backwards on approach here but it does seem reasonable to support errors if you want them to be emitted |
I want to know when there are parse errors so that I can disconnect the sender. A simple option to the constructor should do :)
The text was updated successfully, but these errors were encountered: