diff --git a/src/client.rs b/src/client.rs index 5ebc02a..71d3278 100644 --- a/src/client.rs +++ b/src/client.rs @@ -318,6 +318,17 @@ pub enum ClientError { ServerPanicked, 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. ///