hyperium / h2

HTTP 2.0 client & server implementation for Rust.
MIT License
1.35k stars 270 forks source link

`Reason::PROTOCOL_ERROR` and `Reason::INTERNAL_ERROR` provide little useful information about the… error. #558

Open nagisa opened 2 years ago

nagisa commented 2 years ago

I received an error that reads like this:

error: failed to convert response body to bytes (in application)
    caused by: error reading a body from connection: protocol error: unexpected internal error encountered (in hyper)
    caused by: protocol error: unexpected internal error encountered (in h2?)

I believe the last part ("protocol error: unexpected internal error encountered") is coming from h2. I'm not sure where it originates and searching the code doesn't have present many instances of INTERNAL_ERROR, either. This error is pretty poor and leaves one hanging, so I feel like we should not have these variants as valid options at all, always opting for a more descriptive reason of some sort.

seanmonstar commented 2 years ago

True, the messages don't explain much. The error codes themselves are in the HTTP/2 specification, and a remote can send them with optional extra debug info, or with nothing. If they send us nothing else, there's not too much more we can do... Though, there is #556 which will try to improve the messages some. In particular, it will add the extra debug data if received, and it will include in the error message whether it was an error code received from the remote, or an error condition we detected locally in the library.