From d1c583e997f95dff69fe85f45af6c5bb27db6921 Mon Sep 17 00:00:00 2001 From: 4o1x5 <4o1x5@4o1x5.dev> Date: Sun, 24 Nov 2024 00:43:23 +0100 Subject: [PATCH] implemented display for clienterror --- src/client.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) 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. ///