-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
Refactor errors (fixes #530) #556
Conversation
48eb28f
to
c755975
Compare
fcdcd3b
to
f8ccae8
Compare
Seems like there are no tests for resets, will check that out. |
d058cb7
to
276b1e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I think this is a big improvement to help identify where an error actually came from. Some notes inline, some important, some just rambling at a cloud.
src/error.rs
Outdated
Kind::GoAway(ref debug_data, reason, initiator) => { | ||
write!(fmt, "go away from {}: {}", initiator, reason)?; | ||
if !debug_data.is_empty() { | ||
write!(fmt, " ({:?})", debug_data)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be including the debug data in the Display implementation? It might be useful, or it could be complete junk. Maybe we should, but also maybe it should only be showed in Debug...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use Display
and it's a bit bothersome to use Debug
for one specific error.
What about Display
but only the alternate format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. Alternate output might be a good use here... Do you know what other HTTP/2 libraries do with the debug-data? Like netty, or grpc, or other...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seanmonstar Let's merge it? 🥺
09909f5
to
77969a6
Compare
The errors are fixed by #557. |
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.