Skip to content

Commit efa0b26

Browse files
authored
feat(client): add a TrySendError::error() method (#3885)
this commit introduces a new inherent method to `hyper::client::conn::TrySendError<T>`. this error type includes a `TrySendError::into_error()` method today that will consume the `TrySendError<T>`, returning the inner error. this commit introduces a new method that allows callers to inspect the error, e.g. to update metrics, without needing to consume the error. this is akin to #3884, which added the `TrySendError::message()` method that returns a reference to the `T`-typed message when applicable. Signed-off-by: katelyn martin <[email protected]>
1 parent 03fd6af commit efa0b26

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/client/dispatch.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ impl<T> TrySendError<T> {
317317
pub fn into_error(self) -> crate::Error {
318318
self.error
319319
}
320+
321+
/// Returns a reference to the inner error.
322+
pub fn error(&self) -> &crate::Error {
323+
&self.error
324+
}
320325
}
321326

322327
#[cfg(feature = "http2")]

0 commit comments

Comments
 (0)