Refactor errors internals (#556)

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.

Fixes #530
This commit is contained in:
Anthony Ramine
2021-09-28 18:04:35 +02:00
committed by GitHub
parent cab307d2ed
commit 465f0337f8
26 changed files with 464 additions and 432 deletions

View File

@@ -104,8 +104,14 @@ macro_rules! ready {
mod codec;
mod error;
mod hpack;
#[cfg(not(feature = "unstable"))]
mod proto;
#[cfg(feature = "unstable")]
#[allow(missing_docs)]
pub mod proto;
#[cfg(not(feature = "unstable"))]
mod frame;
@@ -125,7 +131,7 @@ pub use crate::error::{Error, Reason};
pub use crate::share::{FlowControl, Ping, PingPong, Pong, RecvStream, SendStream, StreamId};
#[cfg(feature = "unstable")]
pub use codec::{Codec, RecvError, SendError, UserError};
pub use codec::{Codec, SendError, UserError};
use std::task::Poll;