Skip to content
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

Expose more h2 error kinds #574

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ enum Kind {
/// A RST_STREAM frame was received or sent.
Reset(StreamId, Reason, Initiator),

/// A GO_AWAY frame was received or sent.
/// A GOAWAY frame was received or sent.
GoAway(Bytes, Reason, Initiator),

/// The user created an error from a bare Reason.
Expand Down Expand Up @@ -86,6 +86,22 @@ impl Error {
kind: Kind::Io(err),
}
}

/// Returns the true if the error is from a GOAWAY frame
pub fn is_go_away(&self) -> bool {
match self.kind {
Kind::GoAway(..) => true,
_ => false,
}
}

/// Returns the true if the error is from a RST_STREAM frame
pub fn is_reset(&self) -> bool {
match self.kind {
Kind::Reset(..) => true,
_ => false,
}
}
}

impl From<proto::Error> for Error {
Expand Down