tower_load_shed/
error.rs

1//! Error types
2
3use std::fmt;
4
5pub(crate) type Error = Box<dyn std::error::Error + Send + Sync>;
6
7/// An error returned by `Overload` when the underlying service
8/// is not ready to handle any requests at the time of being
9/// called.
10pub struct Overloaded {
11    _p: (),
12}
13
14impl Overloaded {
15    pub(crate) fn new() -> Self {
16        Overloaded { _p: () }
17    }
18}
19
20impl fmt::Debug for Overloaded {
21    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
22        f.write_str("Overloaded")
23    }
24}
25
26impl fmt::Display for Overloaded {
27    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
28        f.write_str("service overloaded")
29    }
30}
31
32impl std::error::Error for Overloaded {}