From facada6f8d5aecb5ce0bc2a13042622f93f15807 Mon Sep 17 00:00:00 2001 From: Daniel López Azaña Date: Sun, 31 Mar 2024 21:39:46 +0200 Subject: ♻️ (error.rs): remove unnecessary error conversions for IllegalArgumentException and IllegalStateException ♻️ (ls_client.rs): refactor connect method to accept shutdown signal and return generic error ✨ (ls_client.rs): add support for graceful shutdown using Notify ✨ (ls_client.rs): implement session creation and subscription logic in connect method ♻️ (main.rs): replace SharedState with Notify for handling shutdown signal ✨ (main.rs): add retry logic with a maximum of 5 retries for the client connection in main function ✨ (main.rs): ensure graceful client disconnect and orderly shutdown of the application MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/error.rs | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs index 9c3a916..cd1d7c2 100644 --- a/src/error.rs +++ b/src/error.rs @@ -22,12 +22,6 @@ impl Error for IllegalArgumentException { } } -impl From> for IllegalArgumentException { - fn from(error: Box) -> Self { - IllegalArgumentException::new(&error.to_string()) - } -} - #[derive(Debug)] pub struct IllegalStateException { details: String @@ -49,22 +43,4 @@ impl Error for IllegalStateException { fn description(&self) -> &str { &self.details } -} - -impl From> for IllegalStateException { - fn from(error: Box) -> Self { - IllegalStateException::new(&error.to_string()) - } -} - -impl From for IllegalStateException { - fn from(err: serde_urlencoded::ser::Error) -> Self { - IllegalStateException::new(&format!("Serialization error: {}", err)) - } -} - -impl From for IllegalStateException { - fn from(err: tokio_tungstenite::tungstenite::Error) -> Self { - IllegalStateException::new(&format!("WebSocket error: {}", err)) - } } \ No newline at end of file -- cgit v1.2.3