egg-mode-rs / egg-mode

a twitter api crate for rust
https://crates.io/crates/egg-mode
Mozilla Public License 2.0
372 stars 65 forks source link

Occasional panics while using streaming API #98

Open hdevalence opened 4 years ago

hdevalence commented 4 years ago

While using the streaming API I occasionally get panics like

thread 'main' panicked at 'byte index 140 is out of bounds of `Woo! 🙌 CC Search now includes openly licensed images from @smithsonian, @Europeanaeu, and @sciencemuseum! 🔎 https://t.co/76rOFxYXsc`', /home/hdevalence/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/str/mod.rs:1920:47

The tweet is here: https://twitter.com/creativecommons/status/1275116645225299976

I think this is maybe related to the transformation mentioned in #90 (changing between codepoint offsets and byte offsets).

QuietMisdreavus commented 4 years ago

The next time this happens, would it be possible to capture a backtrace? I'm wondering what's trying to slice the text (and also where the index 140 is coming from, since none of the entities i'm seeing from Twitter lie on that index), since it doesn't seem like the streaming code is doing anything special above "try the Tweet deserializer". Unless the streaming API is giving different data from the REST API, this is just a confusing situation.