1 //! Error types for the [`tower::balance`] middleware. 2 //! 3 //! [`tower::balance`]: crate::balance 4 5 use std::fmt; 6 7 /// The balancer's endpoint discovery stream failed. 8 #[derive(Debug)] 9 pub struct Discover(pub(crate) crate::BoxError); 10 11 impl fmt::Display for Discover { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result12 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 13 write!(f, "load balancer discovery error: {}", self.0) 14 } 15 } 16 17 impl std::error::Error for Discover { source(&self) -> Option<&(dyn std::error::Error + 'static)>18 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { 19 Some(&*self.0) 20 } 21 } 22