andrewbanchich / shreddit

Delete your Reddit data.
MIT License
235 stars 9 forks source link

EOF while parsing a value #101

Open createthis opened 6 days ago

createthis commented 6 days ago

This tool works for a while, then I eventually get this error:

thread 'main' panicked at /Users/jesse/.cargo/registry/src/index.crates.io-6f17d22bba15001f/shreddit-0.9.3/src/things/post.rs:168:10:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Decode, source: Error("EOF while parsing a value", line: 1, column: 0) }
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: <async_stream::async_stream::AsyncStream<T,U> as futures_core::stream::Stream>::poll_next
   4: shreddit::main::{{closure}}
   5: tokio::runtime::scheduler::current_thread::Context::enter
   6: tokio::runtime::context::scoped::Scoped<T>::set
   7: tokio::runtime::scheduler::current_thread::CoreGuard::block_on
   8: tokio::runtime::context::runtime::enter_runtime
   9: shreddit::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Let me know if there is anything I can do to help you debug this. I'm dabbling with rust as part of my job lately.

My version was installed from cargo, I believe:

shreddit 0.9.3
andrewbanchich commented 4 days ago

Hi! That implies that the response from Reddit's API is failing to deserialize into JSON here.

If you'd like to try it out yourself you could debug this by cloning this repo and updating that line to use text() instead of json(), then just dbg!() the response. It would probably be hard for me to do that myself since I've never run into that myself.

It might be a good improvement to shreddit to just use text() instead of json() in every case, then try to parse that as JSON separately so that we can error! log the value if it fails to deserialize to JSON at all. If you're interested in making a PR for this it would be appreciated, but up to you!