tower/balance/
error.rs

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