Skip to content

Commit 8088ca6

Browse files
committed
feat: add Error::is_library method
1 parent 481c31d commit 8088ca6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/error.rs

+10
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ impl Error {
103103
Kind::GoAway(_, _, Initiator::Remote) | Kind::Reset(_, _, Initiator::Remote)
104104
)
105105
}
106+
107+
/// Returns true if the error was created by `h2.
108+
///
109+
/// Such as noticing some protocol error and sending a GOAWAY or RST_STREAM.
110+
pub fn is_library(&self) -> bool {
111+
matches!(
112+
self.kind,
113+
Kind::GoAway(_, _, Initiator::Library) | Kind::Reset(_, _, Initiator::Library)
114+
)
115+
}
106116
}
107117

108118
impl From<proto::Error> for Error {

0 commit comments

Comments
 (0)