-
-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redesign the h2::Error type #530
Comments
Once those two
Also, instead of just passing around the last stream id from the |
Yes, for the connection error variant, I've wanted to add the I've wanted to redesign the
|
Currently there is no way to distinguish between errors generated by h2 itself and remote stream/connection errors, correct? |
Oh yes, that's another point I forgot to include, is it an error the remote told us about, or is it an error "we" noticed about the remote doing something wrong. |
I've started working on this and there are 4 different kinds of errors we need to disambiguate:
|
I'd like to offer another axis to how we could categorize errors: stream, connection, and user. With a getter to determine if we received the error over the wire, or generated it locally. I'd also like to consider keeping the |
For example, here's some sample We received a GOAWAY:
We found an illegal SETTINGS frame on the wire
We received a DATA frame without enough window capacity
We got a RST_STREAM frame.
|
Why is there no How do you represent IO errors? |
I'm also not sure how you can check whether the error came from the wire or not from those payloads. |
Another issue: what happens to |
Eh, there could be! Seemed like duplicate information that was already in the
Probably as a
impl Error {
// method naming is hard
pub fn is_from_peer(&self) -> bool {
self.source().map(|e| e.is::<frame::Reset>() || e.is::<frame::GoAway>()).unwrap_or(false)
}
}
Does it need to change? I haven't thought about it really. We already know the stream, so stream ID, doesn't help much. I guess returning an |
My point was that you provided two samples using the same type but with different fields in both, which is quite confusing to me. |
Your plan also does not let the user check whether the error came from the h2 crate itself because the other peer didn't properly follow the protocol. |
There are some I/O errors we expect, but we most probably want to know when an origin server replied back with |
The |
h2::Error now knows whether protocol errors happened because the user sent them, because it was received from the remote peer, or because the library itself emitted an error because it detected a protocol violation. It also keeps track of whether it came from a RST_STREAM or GO_AWAY frame, and in the case of the latter, it includes the additional debug data if any.
h2::Error now knows whether protocol errors happened because the user sent them, because it was received from the remote peer, or because the library itself emitted an error because it detected a protocol violation. It also keeps track of whether it came from a RST_STREAM or GO_AWAY frame, and in the case of the latter, it includes the additional debug data if any.
h2::Error now knows whether protocol errors happened because the user sent them, because it was received from the remote peer, or because the library itself emitted an error because it detected a protocol violation. It also keeps track of whether it came from a RST_STREAM or GO_AWAY frame, and in the case of the latter, it includes the additional debug data if any.
h2::Error now knows whether protocol errors happened because the user sent them, because it was received from the remote peer, or because the library itself emitted an error because it detected a protocol violation. It also keeps track of whether it came from a RST_STREAM or GO_AWAY frame, and in the case of the latter, it includes the additional debug data if any.
h2::Error now knows whether protocol errors happened because the user sent them, because it was received from the remote peer, or because the library itself emitted an error because it detected a protocol violation. It also keeps track of whether it came from a RST_STREAM or GO_AWAY frame, and in the case of the latter, it includes the additional debug data if any.
h2::Error now knows whether protocol errors happened because the user sent them, because it was received from the remote peer, or because the library itself emitted an error because it detected a protocol violation. It also keeps track of whether it came from a RST_STREAM or GO_AWAY frame, and in the case of the latter, it includes the additional debug data if any.
Originally posted by @seanmonstar in hyperium/hyper#2500 (comment)
AFAICT we want
DynConnection::error
andConnectionInner::error
to at the very least be anOption<frame::GoAway>
instead of a plainOption<Reason>
.The text was updated successfully, but these errors were encountered: