Skip to content

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

Open
@jbyman

Description

@jbyman

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions