1 //! Error types 2 3 use std::fmt; 4 5 pub(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. 10 pub struct Overloaded { 11 _p: (), 12 } 13 14 impl Overloaded { new() -> Self15 pub(crate) fn new() -> Self { 16 Overloaded { _p: () } 17 } 18 } 19 20 impl fmt::Debug for Overloaded { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result21 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 22 f.write_str("Overloaded") 23 } 24 } 25 26 impl fmt::Display for Overloaded { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result27 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 28 f.write_str("service overloaded") 29 } 30 } 31 32 impl std::error::Error for Overloaded {} 33