diff --git a/src/client/dispatch.rs b/src/client/dispatch.rs index 412f7af52c..efbf9f0e9c 100644 --- a/src/client/dispatch.rs +++ b/src/client/dispatch.rs @@ -1,3 +1,5 @@ +use std::error::Error as StdError; +use std::fmt; use std::task::{Context, Poll}; #[cfg(feature = "http2")] use std::{future::Future, pin::Pin}; @@ -323,6 +325,22 @@ impl TrySendError { } } +impl fmt::Display for TrySendError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let Self { error, message: _ } = self; + write!(f, "{}", error) + } +} + +impl StdError for TrySendError +where + T: std::fmt::Debug, +{ + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + Some(&self.error) + } +} + #[cfg(feature = "http2")] pin_project! { pub struct SendWhen