Skip to content
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

[Question] What is the convention around handling TweetParseError errors? #536

Open
jbyman opened this issue Jun 13, 2024 · 0 comments
Open

Comments

@jbyman
Copy link

jbyman commented Jun 13, 2024

Hello,

Thank you for this library! This has been great so far. I had a question I was hoping you'd be able to help with (apologies if I missed this in the docs or existing issues).

I'm using this library for some reasonably high throughput tweets, and occasionally we'll hit the tweet parse errors:

stream.on(ETwitterStreamEvent.TweetParseError, (err) => {
      Log('Error parsing tweet from stream', {
        msg: err.message,
        name: err.name,
      });
});

This is relatively seldom, only once in every few thousand tweets. However, I'm curious what the intended behavior should be on my side? The errors look something like:

Unexpected non-whitespace character after JSON at position {}

My assumption is that this is due to the partial tweets received from Twitter, where the buffer gets corrupted and the tweet isn't JSON-parsable. I have reconnect logic in the case of errors which seems to work well, but my question is: is this error actionable? As far as I can tell we don't have access to the corrupted JSON itself, but I'm curious what I should be doing when this signal occurs, if anything?

Thank you in advance!

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

No branches or pull requests

1 participant