implemented display for clienterror

This commit is contained in:
Barna Máté 2024-11-24 00:43:23 +01:00
parent 894327ba00
commit d1c583e997

View file

@ -318,6 +318,17 @@ pub enum ClientError {
ServerPanicked, ServerPanicked,
TimeoutReached, TimeoutReached,
} }
impl Display for ClientError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self.to_owned() {
Self::FailedDecode => write!(f, "Failed to decode response"),
Self::FailedToSend => write!(f, "Failed to send job"),
Self::InvalidResponse => write!(f, "Received invalid response"),
Self::ServerPanicked => write!(f, "The server on the other end has panicked"),
Self::TimeoutReached => write!(f, "The client has reached the timeout"),
}
}
}
/// A Client-side trait that needs to be implemented for a type in order for the client to know return types. /// A Client-side trait that needs to be implemented for a type in order for the client to know return types.
/// ///