quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.76k stars 380 forks source link

Error message for missing runtime not very helpful #1591

Closed terrarier2111 closed 1 year ago

terrarier2111 commented 1 year ago

I experimented a bit with async and quinn and got this error "Error: no async runtime found", after fixing it this is what i can say. The message didn't indicate that it's src even was the quinn crate and it didn't indicate where the point of failure to find the runtime was. Something like a stacktrace with quinn explicitly mentioned as the src of the error would be a lot more helpful.

djc commented 1 year ago

Can you be more concrete about how/when you encountered this error?

Ralith commented 1 year ago

This error can arise when using quinn::Endpoint convenience constructors. It is one of the least obscure errors that can arise there.

You need to structure your error reporting in such a way that you identify their origin; this is a common requirement for Rust code in general, and quinn cannot solve it for you. For example, you could use the anyhow crate, which makes it easy to add context and can automatically attach backtraces.